|laziness, impatience, and hubris
Re: Is it possible to insert a record after line 5 that appears on line 10?by AndyZaft (Hermit)
|on Jun 23, 2010 at 21:47 UTC
Been at least 15 years since I worked in a bank, but because of it I always assume all data files can come in massive sizes, so based on that my solution would be something along the lines of ...
Print everything till you hit :17B:, then you consider this the start of a record to watch for. Feed the lines that follow to an array till the first :35B: record, at which point you are ready to process this "block" between 17B and 35B. If there was a :16R:SECMOVE in between you print the first record of array, then the last, and then the rest, minus the last one, then go back to printing rows till you hit :17B: again. Of course spit out the array if there was no :16R:SECMOVE in there. Don't forget to empty the array before reuse.
Obviously if :16R: can occur before :17B: and still need to process it that way, just modify accordingly. Guess it would help if I knew anything about these records and if they have any kinda order or whatnot. You could probably do this as an AWK oneliner too.