re: Mass Replace

"c.n naveen" <[email protected]>
Newsgroups gmane.linux.redhat.release.enigma
Message-ID <[email protected]>
 
> 
> Message: 1
> From: "Faisal" <[email protected]>
> To: "Enigma-List@Redhat. Com"
> <[email protected]>
> Subject: Mass Replace
> Date: Mon, 2 Jun 2003 16:10:26 -0700
> Organization: Silk Internet Services
> Reply-To: [email protected]
> 
> Hi,
> 
> Is there any program can replace particular value
> from files. Like I
> only define the path of folder and it can read each
> file inside the
> folder and replace it with value I define.
> 
> Like I need to change company name from over 200
> files htmls with new
> name how can I do that.
> 


   If all your html files are in the same directory
try this out the following script
  
    for file in $*
    do

       sed s/compname/newcompname/g $file >          
                                 /tmp/temp.html
       mv /tmp/temp.html $file
   
    done 

 Let us say this script is named test.sh then run it
as follows : 

    sh test.sh *.html   
    
Before doing this keep a backup of your files.

Naveen.





> 
> Regards,
> 
> Faisal Ashraf 
> Manager Network Operations 
> Silk Internet Services 
> 
> 
> 
> --__--__--
> 

> 


________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
       visit http://in.tv.yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.