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.

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 09-14-2005
Registered User
 

Join Date: Sep 2005
Posts: 17
sed help again

I am trying to insert a line after a line whose value is stored in a variable $LASTLINE

sed "/$LASTLINE/a\newuser $user" $file > $file.new

This should insert a line starting with 'newuser' followed by 10 spaces and then $user the value of which the user will enter. But the above command does not work. Any help is appreciated.

Thanks
Forum Sponsor
  #2  
Old 09-14-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Why doesn't the command work?

Is the "user" variable set?

a is append... not insert....

Please be more specific about why the command isn't working as you'd expect.

Cheers
ZB
  #3  
Old 09-14-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,681
Didnt Ygor's solution in the sed help post of yours, help ?

vino
  #4  
Old 09-14-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Indeed. Duplicate post. Thread closed.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:27 PM.


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