![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Extract sequence blocks | solli | Shell Programming and Scripting | 7 | 03-26-2009 11:38 PM |
| How to extract a portion of text from a log file | atilano | UNIX for Dummies Questions & Answers | 2 | 01-27-2009 10:25 AM |
| c program to extract text between two delimiters from some text file | kukretiabhi13 | High Level Programming | 7 | 12-03-2008 06:29 PM |
| Delete blocks of lines from text file | nrbhole | Shell Programming and Scripting | 4 | 12-19-2007 06:17 AM |
| How to extract text from xml file | chrisf | Shell Programming and Scripting | 3 | 09-01-2007 03:25 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
extract blocks of text from a file
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... |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|