The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Request Tracker sparcguy SUN Solaris 6 2 Weeks Ago 02:39 PM
Request moe2266 Post Here to Contact Site Administrators and Moderators 1 11-30-2007 10:08 AM
a request for help... patrick99e99 UNIX for Advanced & Expert Users 1 07-24-2006 11:50 PM
Async DNS request LocalStorm SUN Solaris 1 12-17-2005 08:32 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-08-2005
Registered User
 

Join Date: Mar 2005
Posts: 2
Request sed help

Hi,

I've got two values say "var1" and "var2".

I want to replace the occurence of "var1" in the header of a file with "var2".

Something like this -

head -1 header.dat | sed "/s/$var1/$var2"

which I know is wrong. Can someone help me out here.

Thx
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-08-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,356
You were close...
sed "s/$var1/$var2/"
Reply With Quote
  #3 (permalink)  
Old 03-08-2005
Registered User
 

Join Date: Mar 2005
Posts: 2
Thumbs up Thanks

Thanks Perderabo. It worked.

Yup, as u said... so close ... yet so far ...

Thx.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:02 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0