This should do your work, as long as your strings dont have any special
chars. 
perl -pli.BAK -e 's/OLDSTRING/NEWSTRING/g' FILENAME

(You can also use it for multiple files and will create a .BAK file
incase you want to revert )

HTH
Ram


On Mon, 2004-07-26 at 17:21, Jerry M. Howell II wrote:
> hello all,
> 
>    I'm just beginning to work with sed in shell scripts I was wondering
> if anyone has a simmilar script in perl they can send my way or what the
> perl equivelent of the sed /s would be. Here is the coresponding shell
> script if it'll help you understand what I'm trying to acomplish.
> 
> #!/bin/sh
> 
> # Need some information from you
> 
> echo "what word or string are we looking for?"
> read old
> echo ""
> echo "what do you wish to replace it with"
> read new                        
> for script in *                 
> do                              
> sed 's/'$old'/'$new'/g' <$script> outfile
> mv outfile $script              
> done
> 
> sometimes this script works and sometimes it just clears the file out
> leaving it empty. I need a viable alternative but don't even know where
> to start. Thanks for any help you can give me.
> 
> -- 
> Jerry M. Howell II
> 
> email admin: usalug.org
> 
> sys admin:   hostbyk
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to