I need to process a large data file containing multi-line records, an example input:
1 Name Dan
1 Title Professor
1 Address aaa street
1 City xxx city
1 State yyy
1 Phone 123-456-7890
2 Name Luke
2 Title Professor
2 Address bbb street
2 City xxx city
3 Name Tom
3 Title Associate Professor
3 Like Golf
4 Name
4 Title Trainer
4 Likes Running
Note that the first integer field is unique and truly identifies the whole record. So in the above input, I really have 4 entries, although I don't know how many attribute lines each record can have. I need to: - define a valid record (there should be a field "Name" and "Name") - display the available attributes for each valid record, for example, "Name", "Name", "Address" - these are the necessary fields.
Output Example:
1 Name Dan
1 Title Professor
1 Address aaa street
2 Name Luke
2 Title Professor
2 Address bbb street
3 Name Tom
3 Title Associate Professor
, 4 , "". 3 "", , "" "".
awk? , "id" ?
unix shell script !:)