[Chicago-talk] replace in place
JT Smith
jt at plainblack.com
Fri Mar 11 12:34:10 PST 2005
Thank you so much!
On Fri, 11 Mar 2005 14:29:51 -0600
Andy Lester <andy at petdance.com> wrote:
> On Fri, Mar 11, 2005 at 02:20:20PM -0600, JT Smith (jt at plainblack.com) wrote:
>> I remember having a really great tutorial on doing things in one line from
>> the command line in perl, but I can't remember how it all worked. Could
>> somebody help me out? I have a make file that has a line in it I wish to
>> replace. The line looks like:
>
> "A Field Guide To The Perl Command-Line Options" at
> http://www.petdance.com/perl/
>
>> prefix=/usr/local
>>
>> And I would like it to be
>>
>> prefix=/data/prereqs
>
> perl -i -p -e's[/usr/local][/data/prereqs]g' Makefile
>
> or
>
> perl -i -p -l -e'$_ = "prefix=/data/prereqs" if $_ eq "prefix=/usr/local"' Makefile
>
> You can replace
>
> Makefile
>
> with
>
> `find . -name Makefile`
>
> to find all Makefiles in the tree if you like.
>
>
> --
> Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
JT ~ Plain Black
ph: 703-286-2525 ext. 810
fax: 312-264-5382
http://www.plainblack.com
Create like a god, command like a king, work like a slave.
More information about the Chicago-talk
mailing list