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!

delete lines

Status
Not open for further replies.

vti

Technical User
Feb 26, 2001
189
TR
Hi all,


i want to delete lines where starts with "USER_PATH=/usr/ase..." and second line is "export USER_PATH."

Thanks for any help
 
Something like
/^USERPATH/,/export USER_PATH/ { next } # skip between lines
{ print } # print everything else
 
hi Salem
Thanks for help but i need to delete those lines and i also have to apply with a script cause i have lots of files which has same lines.




 
Put my previous program into a file, say
remlines

then write another script along the lines of this
Code:
for i *.txt; do  # for each txt file
  remlines $i > tmp$$  # remove the required lines
  cp tmp$$ $i          # copy the output back over the original
done
rm tmp$$               # tidy up
You'll want to omit the 'cp' command until you're confident that its all working properly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top