The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Confusion about 1>&2 and 2>&1 navi Shell Programming and Scripting 1 06-03-2008 07:26 AM
Confusion In run level... udayn SUN Solaris 1 02-16-2008 09:07 AM
'tr' confusion Nafanja UNIX for Dummies Questions & Answers 2 12-05-2007 08:47 PM
ftp confusion intern UNIX for Dummies Questions & Answers 1 06-08-2006 03:20 PM
ISO Confusion? Mr_Pinky UNIX for Dummies Questions & Answers 6 09-19-2005 03:14 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 11-16-2006
Registered User
 

Join Date: Jun 2006
Posts: 39
Sed confusion

Hello all,

I am trying to delete all the lines in a particular file having a pattern. The problem is that it has special characters and for some reason is not doing the job.

For eg.

src_file
/home/test/filelist.txt :xxxxgog
/home/test/RCH/ogogogg
/home/test/RYHUJ/HHHH
/home/test/filelist.txt :dfgdfg

target file:
/home/test/RCH/ogogogg
/home/test/RYHUJ/HHHH


So basically I want to remove all the lines that contain the pattern /home/test/filelist.txt

Im using sed to do this but for some reason it is not working.

Code:
sed -e 's/\/home\/test\/filelist.txt$//g' srcfile > /home/abc/tgtfile
Any help appreciated.
Reply With Quote
Forum Sponsor
  #2  
Old 11-16-2006
mona's Avatar
Registered User
 

Join Date: Nov 2005
Location: Singapore
Posts: 96
Try this command


Code:
sed '/\/home\/test\/filelist.txt/ d' srcfile
Reply With Quote
  #3  
Old 11-16-2006
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Or just use grep -v
Reply With Quote
  #4  
Old 11-17-2006
Registered User
 

Join Date: Jun 2006
Posts: 39
Thankss Zazzy...I didnt know abt the grep -v option...its awesome!!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0