The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-05-2008
jaduks's Avatar
jaduks jaduks is offline
Registered User
  
 

Join Date: Aug 2007
Location: Assam,India
Posts: 167
See this:


Code:
$ cat ea.txt
root 1933 1923 localhost calm 32rhewr

$ A=root

$ B=ROOT

$ sed 's/$A/$B/g' ea.txt
root 1933 1923 localhost calm 32rhewr

**No change above

So use double quotes instead of single quote: 

$ sed "s/$A/$B/g" ea.txt
ROOT 1933 1923 localhost calm 32rhewr

So 

LINECHANGE=`sed s/$OLDLINE/$NEWLINE/ $filename`

should be something like this:

LINECHANGE=`sed "s/$OLDLINE/$NEWLINE/" $filename`

//Jadu