The first part (ORG-002) is code and their counts. There can be duplicate code in first part. The second part (ORG-2) is the summation (total) of the code counts. Now I want to split the first half and second half in to different files. The only differenct that can be seen is that indidual CODE have ORG no as ORG-00 i.e there are 2 zeros after ORG. For summation level data, there is only one zero after ORG. (ORG-0)
Still no headings? Not even a business date that the report is produced for? Page numbers?
You are now showing 001/01. Can we guess that this is followed by 002/02? So that you have alternate "chunks" of report that you want to split?
By far the easiest is to go back to the program that produces the report, and to do two seperate reports. If you can't do this, let us know why not before we go chasing solutions.
To split the report from DFSORT/ICETOOL we'd need to be able to accurately identify the stuff you want on one report and the stuff you want on the other.
As yet, we can't do this.
Sit down and look at your report. Think hard about what you would need to know with a robot collator. Work out exactly what you'd need to know to program the robot. That is what we'd need.
If you are not yet experienced in this method, try this: work out exactly what you need to do to make a cup of tea how you like it. Write it all down. Then make a cup of tea exactly as you have written it all down. If you get it right first time (I've never seen it done) then you are a genius, and you won't need us. If you don't get it right, then you'll get a better idea of how you have to explain things to people when you have a problem seeking a solution.
Someone has in their sig, something like "a problem explained well is a problem half-solved". Often, in just explaining everything without your pre-conceptions about what others "should" know, but don't, you'll even come to your answer.
Will your input file contain only one set of data. i.e Will it have only ORG 001 and ORG 01. Or Will there be multiple occurances?
Will it always occur in this order ?
Still the requirements are not clear. As per my understanding, If your input file has both the individual records and summed value record.
1. sort your file with the code and count in descending order.
2. Extract the first duplicate of all the code (which is the summation of the count record) in one file and other file will have all the remaining count values.
If this is not what you intended, you need to explain us clearly how your input file look like and what is the expected output.