[ale] sed

cfowler cfowler at outpostsentinel.com
Thu May 17 19:57:50 EDT 2007


Your subject is SED but Perl in body.

#1. Sed
 sed 's/abc/xyz/g' < input > output

#2 Perl
perl -e 'while(<>) { s/abc/xyz/g; }' < input > output

On Thu, 2007-05-17 at 19:43 -0400, Terry Bailey wrote:
> Hi,
> 
> I want to take a text file and replace each occurrence of abc with 
> xyz.  I know that this can be done with an editor like nano; however, 
> I want to do this within a Perl script.   I think sed can be used to 
> do this and I have known about it since my UNIX days, but have never 
> used it. Can anyone tell me what the syntax would be?
> 
> Thanks,
> 
> Terry Bailey
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale




More information about the Ale mailing list