cancel
Showing results for 
Search instead for 
Did you mean: 

equivalent in perl

Balaji N
Honored Contributor

equivalent in perl

gurus,

what is the equivalent of this in perl

sed '1s/blablabla/bla/' file.txt

basically i want to the reg exp substitution to happen on specific lines and not on all.

tia
-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
2 REPLIES
Steven E. Protter
Exalted Contributor

Re: equivalent in perl

This is how I did it:

$commandline - "sed /s/tzfat/hebron/g $filename";

system("$commandline");

I know, cheating, cheating ...

This stuff is discussedin O'reilly's Perl Cookbook Chapter 6 Pattern matching.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Balaji N
Honored Contributor

Re: equivalent in perl

perl -pi -e '1 .. s/blablabla/bla' file.txt

thanks SEP for pointing the right resource.

-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.