We wanted a conversion from a source extract to tabular file. I am trying to explain with a below sample.
We have the source file as below with each highlighted set of rows represent a record. In each row the first value represents a field (“1” always signify the first filed or beginning of a new record) and the second value represents the corresponding value. Only for field 75700 it stores a type for which the corresponding value gets stored in field 75701 (in the next row) . 75700 can have multiple values (7000,45457000 etc) among which 7000 which holds the actual value which we’ll be storing. Corresponding value will be in the column 75701.
Trying to demonstrate with the below sample –
Source file -
1,850000225
2,item2
27,item3
75700,7000
75701,item4
1,850000225
2,item5
27,item6
5000,item7
5001,item8
75700,45457000
75701,item4
1,850000451
400,item9
410,item10
420,item11
423,item12
Expected tabular formatted file -
1|2|27|400|410|420|423|5000|5001|75701
850000225| item2| item3|||||||item4 (stored the value for field 75700)
850000225|item5|item6|||||item7|item8| (didn’t store stored the value for field 75700 as ‘Type’ was different)
850000451||||item9|item10|item11|item12|||
Can any one of you help me scripting it in UNIX?