The UNIX and Linux Forums  

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



Thread: sed help
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 12-08-2004
yeshwants yeshwants is offline
Registered User
 

Join Date: Dec 2004
Posts: 2
sed help

I have to search and replace a string in a file and I am using the following command in a script.

sed "s/a/b/g" file

All the occurances of a are getting replaced by b except the last line since it does not have a return character at the end of line. If I enter space at the end of last last and
then use the above sed command then it works fine.

I want to know if there is a way I can replace all occurances. Else What is the command that I need to include in my script before the sed command so that I can get that extra space at the end of last line
Reply With Quote
Forum Sponsor