Need some logic help!
I have a file with header and detail in the same file format like this
- 1 xyz 1234
2 fgg 1234
2 fgg 1234
2 dfg 1234
1 rfr 5678
2 tgg 5678
2 gtt 5678
2 tty 5678
we differentiate between header and detail by col 1 ( 1 for header, 2 for detail) and we can uniquely identify detail of every corresponding header by col3 ( i.e if col3 of detail match to that of a header then they belong to the header)
I need to generate o/p like this
- 1 xyz 1234
2 fgg 1234 1
2 fgg 1234 2
2 dfg 1234 3
1 rfr 5678
2 tgg 5678 1
2 gtt 5678 2
2 tty 5678 3
Can anyone please tell me the logic for this.( Stage variables ?)