McGibb In Aus
New Member
- Joined
- Feb 7, 2018
- Messages
- 2
Hi All,
I have a number of very large files that I need to split up based on specific delimiter lines in a given cell.
However the delimiter is not a uniform number of lines apart. The basic format of the file is:
<delimiter line>
<Name line>
<Text Line>
...
<Text Line>
<Delimiter line>
With the <Text Lines> there may be multiple text lines or just a single text line before the next delimiter line.
I need to keep a count of each delimiter occurrence. The next line after the delimiter line needs to be stored to another worksheet in column A and the delimiter occurrence number in column B.
Then all the text lines need to be saved/exported to a text using the delimiter occurence number as the filename.
By way of example, suppose this is part of the large file to split up, :
[TABLE="width: 582"]
<colgroup><col></colgroup><tbody>[TR]
[TD]$$$[/TD]
[/TR]
[TR]
[TD]CXR-normal[/TD]
[/TR]
[TR]
[TD]CHEST [/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]Normal heart size and mediastinal contour. The lungs and pleural spaces are clear.[/TD]
[/TR]
[TR]
[TD]$$$[/TD]
[/TR]
[TR]
[TD]Direct[/TD]
[/TR]
[TR]
[TD]Direct comparison is made with the previous study, dated [ ].[/TD]
[/TR]
[TR]
[TD]$$$[/TD]
[/TR]
[TR]
[TD]DVT[/TD]
[/TR]
[TR]
[TD]ULTRASOUND [ ] LEG DVT STUDY[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]CLINICAL NOTES[/TD]
[/TR]
</tbody>[/TABLE]
The delimiter line is the $$$ line, so the first occurrence would be
Saved it a secondary worksheet in cell A1 is 'CRX-Normal' and cell B1 would be simply 1
The 3 text lines would be saved to a separate text file called 1.txt
For the 2nd occurrence:
Saved in the secondary worksheet in cell A2 is 'Direct' and cell B2 would be 2
The a single text line would be saved to a separate text file called 2.txt
For the 2nd occurrence:
A3 is 'DVT' and cell B3 is 3
Then 3 text lines would be saved to 3.txt
and so on....
Hopefully this makes sense and hopefully one of you geniuses can help me out?
Regards
McGibb in Aus
I have a number of very large files that I need to split up based on specific delimiter lines in a given cell.
However the delimiter is not a uniform number of lines apart. The basic format of the file is:
<delimiter line>
<Name line>
<Text Line>
...
<Text Line>
<Delimiter line>
With the <Text Lines> there may be multiple text lines or just a single text line before the next delimiter line.
I need to keep a count of each delimiter occurrence. The next line after the delimiter line needs to be stored to another worksheet in column A and the delimiter occurrence number in column B.
Then all the text lines need to be saved/exported to a text using the delimiter occurence number as the filename.
By way of example, suppose this is part of the large file to split up, :
[TABLE="width: 582"]
<colgroup><col></colgroup><tbody>[TR]
[TD]$$$[/TD]
[/TR]
[TR]
[TD]CXR-normal[/TD]
[/TR]
[TR]
[TD]CHEST [/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]Normal heart size and mediastinal contour. The lungs and pleural spaces are clear.[/TD]
[/TR]
[TR]
[TD]$$$[/TD]
[/TR]
[TR]
[TD]Direct[/TD]
[/TR]
[TR]
[TD]Direct comparison is made with the previous study, dated [ ].[/TD]
[/TR]
[TR]
[TD]$$$[/TD]
[/TR]
[TR]
[TD]DVT[/TD]
[/TR]
[TR]
[TD]ULTRASOUND [ ] LEG DVT STUDY[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]CLINICAL NOTES[/TD]
[/TR]
</tbody>[/TABLE]
The delimiter line is the $$$ line, so the first occurrence would be
Saved it a secondary worksheet in cell A1 is 'CRX-Normal' and cell B1 would be simply 1
The 3 text lines would be saved to a separate text file called 1.txt
For the 2nd occurrence:
Saved in the secondary worksheet in cell A2 is 'Direct' and cell B2 would be 2
The a single text line would be saved to a separate text file called 2.txt
For the 2nd occurrence:
A3 is 'DVT' and cell B3 is 3
Then 3 text lines would be saved to 3.txt
and so on....
Hopefully this makes sense and hopefully one of you geniuses can help me out?
Regards
McGibb in Aus