LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Thread Tools
Old 12-27-2004, 02:13 PM   #1
joey52
Member
 
Registered: Dec 2004
Posts: 59
Thanked: 0
Sed Command & Passing Values


[Log in to get rid of this advertisement]
sed "s/^Intf1=.*$/Intf1=${3}/g" ${HOME}server.cfg > ${HOME}temp.ini


replace

s= substitute
^ is matches the beginning of the line with INtf1 replacing everything after - sign
.* means match all characters
$ end of line


How are we able to pass all acharacters without messing uop the sed command

like #%^
joey52 is offline     Reply With Quote
Old 12-27-2004, 07:44 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: atop the Blue Ridge
Distribution: Debian Lenny, CentOS 5.2
Posts: 7,250
Thanked: 31
"How are we able to pass all acharacters without messing uop the sed command

like #%^"

You escape the special characters with a \ such as:
\#
\%
\^

------------------------------
Steve Stites
jailbait is offline     Reply With Quote
Old 12-27-2004, 08:04 PM   #3
joey52
Member
 
Registered: Dec 2004
Posts: 59
Thanked: 0

Original Poster
sed "s/^Intf1=.*\#\%\^$/Intf1=${3}/g" ${HOME}server.cfg > ${HOME}temp.ini

Is this it? If it is, that is one weird looker there.
joey52 is offline     Reply With Quote
Old 12-27-2004, 08:42 PM   #4
jailbait
Guru
 
Registered: Feb 2003
Location: atop the Blue Ridge
Distribution: Debian Lenny, CentOS 5.2
Posts: 7,250
Thanked: 31
"sed "s/^Intf1=.*\#\%\^$/Intf1=${3}/g" ${HOME}server.cfg > ${HOME}temp.ini

Is this it? If it is, that is one weird looker there."


I think that is OK but bash has the final word, not me.

------------------------
Steve Stites
jailbait is offline     Reply With Quote
Old 12-27-2004, 08:46 PM   #5
joey52
Member
 
Registered: Dec 2004
Posts: 59
Thanked: 0

Original Poster
I will try it tonight, but I guess there is no real easy way to do this other than specifying all the characters.

Thanks for your help.
joey52 is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
Passing form values between multiple forms!! AskMe Programming 5 09-07-2005 08:44 PM
sed and escaping & in something like: echo $y | sed 's/&/_/g' prx Programming 7 02-04-2005 12:00 AM
passing values in shell pantera Programming 1 05-20-2004 10:01 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 07:12 AM
passing variables to sed jjfate Programming 8 07-31-2003 05:15 AM


All times are GMT -5. The time now is 12:30 PM.

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