where 000010 is the sum of rows between the record starting with ST and SE SE*000010*331052579, wherein my case it is 10. I need to have a script which can generate this value and replace the file with the correct count. I am getting files with an incorrect count as SE*000024*331052579. I need to have a script to calculate the segments between ^ST and ^SE inlcuding these 2 and poulate that count as SE*000010*331052579
Please advise and this is an urgent issue.. I am not an unix guy though I am assigned to this
How about the thing that does the printing of this file out. I assume that you are printing each line out from a bean or some object source.
and you provide your own line counter variable.
where FancyPrintStream is:
or if its not a PrintStream you are using, a print writer, a record writer, output stream, basically hook into every time you would render an "end of line" character and increment a line counter, over the span of that record, which you would reset after rendering a complete record.
Error: Keyboard not attached. Press F1 to continue.
As Travis suggested, you need to read each line, look at what type of line it is (record start, record end, or record contents), and print out the appropriate response. You can then easily count line numbers yourself and verify whether they are correct or not. For example:
awk and perl are ideally suited to these sorts of tasks, which is why Unix administrators love this tools so much.