Hi Team,
We have a requirement where we need to format input file using shell script by meeting the below conditions.
-
1. Ignore first 549 characters of that file.
-
2. After that we need to make a file of 100 characters per line, repeat it until the 3rd condition is met.
-
3. If the word �CONTRA' is found in any line, where in that line C is at character position 65 and ends at A with the character position at 70 then stop the processing, rest of data needs to be removed including the �CONTRA' line from that file.
For Ex if the input file is
VOL1000000 851447 1^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
HDR1A851447S 00000000010001 12199 12201 000000 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
HDR2F0200000100 00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UHL1 12200999999 000000001 DAILY 001 0000 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
******************^^^^^^^^^^^^^^
5555555555555555555555555555555 5555555555555555 44444445 555AAAAAA ZXXXXCONTRACTORS
5555555555555555555555555555555 5555555555555555 44444445 555AAAAAA ZXXXXXXXXXXXXXXXXX
5555555555555555555555555555555 5555555555555555 44444445 555AAAAAA ZXXXXXXXXXXXXXXXXX
5555555555555555555555555555555 5555555555555555 44444445 555CONTRA ZXXXXXXXXXXXXXXXXX
5555555555555555555555555555555 5555555555555555 44444445 555AAAAAA ZXXXXXXXXXXXXXXXXX
5555555555555555555555555555555 5555555555555555 44444445 555AAAAAA ZXXXXXXXXXXXXXXXXX
My script should show only the records in brown color as below
5555555555555555555555555555555 5555555555555555 44444445 555AAAAAA ZXXXXCONTRACTORS
5555555555555555555555555555555 5555555555555555 44444445 555AAAAAA ZXXXXXXXXXXXXXXXXX
5555555555555555555555555555555 5555555555555555 44444445 555AAAAAA ZXXXXXXXXXXXXXXXXX
[/COLOR] Any suggestions/opinions will be highly appreciated.
Thanks,
Ajay