Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract section of Text in File 1

Status
Not open for further replies.

Michael42

Programmer
Oct 8, 2001
1,454
US
Hello,

Using a bourne shell script I need to extract some lines from a text file. My file looks like this.
Code:
SQL> SELECT bla bla bla

/export/oracle/myfile1.dbf
/export/oracle/myfile2.dbf
/export/oracle/myfile3.dbf
SQL> spool off

In a file I need to extract just the lines that start with "/export..." to another file (files.lst). The tricky part is that the header twos lines and bottom single line will remain the same BUT the total other lines (with /export...) are variable.

Please, can you off some syntax to grab just the "/export" lines?

Thanks,

Michael42
 
One way:
grep '^/export' /path/to/input > files.lst

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

Very nice and simple solution. :) I was making this way too hard.

Thanks for taking the time to post,

Michael42
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top