Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-19-2004, 05:31 AM   #1
Registered: Jul 2003
Posts: 129

Rep: Reputation: 15
little sed question

hello every1
i wanna delete a line from a file using sed
the probleme is i need to delete line which contain alreadu a slash (/) this last is used in the syntax of sed : exp
sed -e '/tmp/test/d' /etc/test.conf
this wont work ! where :
sed -e '/tmp/d' /etc/test.conf
works proprely and delete the line that contain "tmp"
any idea how to include expressions that contain a slach please ?

Last edited by freelinuxcpp; 01-19-2004 at 05:54 AM.
Old 01-19-2004, 05:32 AM   #2
Registered: Jul 2003
Posts: 129

Original Poster
Rep: Reputation: 15
have to use antislash
sed -e '/tmp\/test/d' /etc/test.conf
anyway thax for those who wanted to help me
but now there is an other problem !
i can not use a variable inside sed command when doing :
cat /etc/apache/httpd.conf
read name
sed -e '/$name/d' /etc/apache/httpd.conf
this dont work anymore !

Last edited by freelinuxcpp; 01-19-2004 at 05:53 AM.
Old 01-19-2004, 06:57 AM   #3
Registered: Aug 2002
Location: MN USA
Distribution: slakware 9.0
Posts: 121

Rep: Reputation: 15
I think you have to expand the variable outside of sed and then feed the results to sed. At least in O'Reilly's Sed & Awk all references to variables are in the awk section.
Old 01-20-2004, 07:36 AM   #4
Registered: Jul 2003
Posts: 129

Original Poster
Rep: Reputation: 15
all i had to do is to use " rather then ' cause with ' the var's value wont be read !
thanx anyway


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
sed question ckoniecny Linux - General 3 11-11-2005 09:31 AM
question on sed tifu Linux - Newbie 3 03-18-2005 04:38 PM
sed question virendratp Programming 3 09-10-2004 03:21 AM
sed question dolvmin Linux - Software 4 03-09-2004 09:27 AM
sed question zoomzoom Linux - Software 2 10-20-2003 04:04 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:51 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration