The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 -->
  #1 (permalink)  
Old 12-05-2006
hemangjani hemangjani is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 73
Smile Replace string B depending on occurence of string A

Depending upon the occurence of string 'xyz', I want to remove -t from the input file.
There is not a fixed length input file.
Any suggestions

Input file:

this is xyz line -t of the data
this is line 2 of -t of the data
xyz this is line 3 of -t the file
this is line xyz of the -t file
this is line 5 of the file -t

Ouput file:

this is xyz line of the data
this is line 2 of -t of the data
xyz this is line 3 of the file
this is line xyz of the file
this is line 5 of the file -t