1000CUS E Y4NYRETAIL
10010004HELIOPOLIS
110000500022360591000056XX EG
1101DEBY XXAD ZSSKY TSSROS
1102HANYNNYY@HOTMAIL.COM
210030/05/201301/06/2013AED
3100 OPE
3100 CLO
3100 The
1000CUS E Y NYCORPORATE
10010004HELIOPOLIS
110000500025270504550203XX EG
1101XXXQ FOR CTING AND GFDGSSS
1102
210030/11/201230/05/2013EUR
3100 OPE
3100
1000CUS E Y NYCORPORATE
I have a large file in the above format. I want loop through the file and generate a report with two columns as shown in the image attached.
HTML Code:
<table border="1">
<tr>
<th>COLUMN1</th>
<th>COMMENTS1</th>
<th>COLUMN2</th>
<th>COMMENTS2</th>
</tr>
<tr>
<td>059100005613</td>
<td>the number appearing at position 15 on the line begining with 1100</td>
<td>8</td>
<td>No of lines between 1st identifier 1000CUS and 2nd identifier 1000CUS</td>
</tr>
<tr>
<td>050455020305</td>
<td>the number appearing at position 15 on the line begining with 1100</td>
<td>7</td>
<td>No of lines between 2nd identifier 1000CUS and 3rd identifier 1000CUS</td>
</tr>
</table>
and so on...
The below command is returning 8, which I think I will need to put in a loop. The one that i'm finding difficul to extract is the information at position 15 on the line begining with 1100.
awk '/1000CUS/&&!f{f=1;next;}/1000CUS/&&f{print x;exit;}f{x++}'
Any pointers would be of great help.
Thanks
Joe