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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

awk off the end of a file 1

Status
Not open for further replies.

stephenk1973

Technical User
Jun 11, 2003
246
GB
I have a text file on which i would like to get rid off anything after a certain phrase. Basically it a import for a database and the last import is no longer required.


My text file is of the format....

*tab_imp1
001
002
003

*tab_imp2
003
004
006

I do not want to do the second imports so i have tried putting in what i thought was any end of file character...

awk -Ftab_imp2 '{print $1"\003"}' file1>file2

I still get the end of the file!

Can anyone please let me know where i am going wrong or the correct method of completeing this.

All suggestions and much appreciated

Thanks

Stephen


 
One way:
awk '/tab_imp2/{exit}1' file1>file2

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top