LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux 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
 
Search this Thread
Old 12-27-2004, 01:13 PM   #1
joey52
Member
 
Registered: Dec 2004
Posts: 59

Rep: Reputation: 15
Sed Command & Passing Values


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 #%^
 
Old 12-27-2004, 06:44 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,467

Rep: Reputation: 153Reputation: 153
"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
 
Old 12-27-2004, 07:04 PM   #3
joey52
Member
 
Registered: Dec 2004
Posts: 59

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

Is this it? If it is, that is one weird looker there.
 
Old 12-27-2004, 07:42 PM   #4
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,467

Rep: Reputation: 153Reputation: 153
"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
 
Old 12-27-2004, 07:46 PM   #5
joey52
Member
 
Registered: Dec 2004
Posts: 59

Original Poster
Rep: Reputation: 15
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.
 
  


Reply


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


All times are GMT -5. The time now is 05:02 AM.

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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration