Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 16 Apr 2014, 12:50
All times are UTC - 4
 Forum index » House Training » Beginners Help ( Start Here)
sed Question (FAQs answer doesn't work!)(Solved)
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
ozboomer


Joined: 04 May 2005
Posts: 93
Location: Melbourne, Australia

PostPosted: Sun 14 Aug 2005, 08:21    Post subject:  sed Question (FAQs answer doesn't work!)(Solved)  

This is sending me silly...

Using puppy v1.0.1 or v1.0.4...

# tmpdir=/tmp/root
# echo /root/etc/hosts | sed 's/root/abc/'

...gives /abc/etc/hosts

# echo /root/etc/hosts | sed 's/root/$tmpdir/'

...gives /$tmpdir/etc/hosts

# echo /root/etc/hosts | sed "s/root/$tmpdir/"

...gives "sed: -e expression #1, char 9: Unknown option to 's'"

The sed FAQs suggest the variable substitution happens when the double-quotes are used... but all I get is the syntax error.

Gnu sed v4.0.7 is included in both Puppy v1.0.1 and v1.0.4.

What do I have to do to get the variable substitution to work!?


John
Back to top
View user's profile Send private message 
Guest
Guest


PostPosted: Sun 14 Aug 2005, 09:18    Post subject:  

tmpdir=/tmp/root
echo /root/etc/hosts | sed "s%/root%$tmpdir%"
Back to top
ozboomer


Joined: 04 May 2005
Posts: 93
Location: Melbourne, Australia

PostPosted: Sun 14 Aug 2005, 09:35    Post subject:  

Anonymous wrote:
tmpdir=/tmp/root
echo /root/etc/hosts | sed "s%/root%$tmpdir%"

Great. Many thanks. Forgot all about the other delimiters Smile
Back to top
View user's profile Send private message 
Guest
Guest


PostPosted: Sun 14 Aug 2005, 09:47    Post subject:  

got beaten to the punch
Back to top
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 10654
Location: Arizona USA

PostPosted: Sun 14 Aug 2005, 20:00    Post subject:  

Bladehunter: isn't it worth answering all those easy questions to find one like this one? Smile
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Beginners Help ( Start Here)
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0382s ][ Queries: 12 (0.0054s) ][ GZIP on ]