• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

Help with awk or similar

Hi, I'm a little rusty with awk scripting...here's what I'm trying to do...given this data file...

   FullName,Murthy, Anne
   LastLogonTime,11/14/2006 9:01 AM
   FullName,Smith, Alex
   LastLogonTime,11/14/2006 9:01 AM

...I would like a script that creates a separate file for each account number (the account number would be the file name) which would contain the corresponding data FullName etc.
1 Solution
awk '{if (((NR - 1) % 4) == 0) {FileName=$0} else {print > FileName}}' YourDataFileName
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now