Hi,
This is part of a large text file I need to separate out.
I'd like some help to build a shell script that will extract the text between sets of dashed lines, write that to a new file using the whole or part of the first text string as the new file name, then move on to the next one and repeat.
The amount of text between the dashes is variable - might be just a couple of lines of text or many lines.
There's one line of space between the dashed line and the first line of text.
Doesn't matter to me if the new output file contains the dashes or not.
It would be nice to flag the ones with "No errors found" by appending that to the filename also, but not necessary.
Thanks!
Input file:
-----------------------------------------------------------------------
3D Survey MBST_BASIN/M93upd05_htti2_TTIvol2_Z (storage m93up5)
No errors found
-----------------------------------------------------------------------
3D Survey m93up5_ip/M93upd05_htti2_TTIvol2_Z (storage m93up5)
No errors found
-----------------------------------------------------------------------
3D Survey MARS_B/Mars-B (storage mars_b)
Seismic files referenced in Oracle not present on disk
This is an ERROR. Files listed below will not open in SeisWorks:
mars_b/mars_b01.3dv
-----------------------------------------------------------------------
3D Survey mars_b_ip/Mars-B (storage mars_b)
Seismic files referenced in Oracle not present on disk
This is an ERROR. Files listed below will not open in SeisWorks:
mars_b/mars_b01.3dv
-----------------------------------------------------------------------
3D Survey AUGER_123DI/szwauger (storage szwauger)
Seismic files referenced in Oracle not present on disk
This is an ERROR. Files listed below will not open in SeisWorks:
szwauger/S_AUGER_123DI_30601.3dh
szwauger/S_AUGER_123DI_30701.3dh
szwauger/S_AUGER_123DI_30801.3dh
szwauger/S_AUGER_123DI_30901.3dh
szwauger/S_AUGER_123DI_31001.3dh
szwauger/S_AUGER_123DI_31101.3dh
szwauger/S_AUGER_123DI_31201.3dh
szwauger/S_AUGER_123DI_31301.3dh
szwauger/S_AUGER_123DI_31401.3dh
szwauger/S_AUGER_123DI_31501.3dh
szwauger/S_AUGER_123DI_31601.3dh
-----------------------------------------------------------------------
2D Project szwauger_1p
-----------------------------------------------------------------------
Desired output :
file 1, named "3D Survey MBST_BASIN"
3D Survey MBST_BASIN/M93upd05_htti2_TTIvol2_Z (storage m93up5)
No errors found
file 2, named "3D Survey m93up5_ip"
3D Survey m93up5_ip/M93upd05_htti2_TTIvol2_Z (storage m93up5)
No errors found
file 3, named "3D Survey MARS_B"
3D Survey MARS_B/Mars-B (storage mars_b)
Seismic files referenced in Oracle not present on disk
This is an ERROR. Files listed below will not open in SeisWorks:
mars_b/mars_b01.3dv
and so on...