Perl is still the best scripting language for peforming mass edits on text files.

By 4 Zen Device on February 09, 2007

Gotta love the simplicity of the following:

$^I = '';

while(<>){

s/\/u\/corp\/bin\/perl/\/usr\/bin\/env perl -w/g;

print;

}

Embed Claim Make a related claim

Discussion (7)

http://www.tapsellferrier.co.uk/nicferrier/

8 nic who disagreed, says

awk can do most of what perl can do and it does it without a lot of hollering.

and then when you need something more than what awk can do you can use something like python (or ruby).

Make a related claim about 1 year ago (link)
http://mwgamera.name/

1 mwgamera who disagreed, says

Awk is quite good, but when I cannot get stuff done with it I usually switch to perl.
But for example given in claim description I would use sed.

Make a related claim about 1 year ago (link)
http://www.tapsellferrier.co.uk/nicferrier/

8 nic who disagreed, says

So you should disagree because awk and sed are clearly very good and you only use perl in extreemis and lots of others don't even use it then.

Make a related claim about 1 year ago (link)
http://linuxgeek71.myopenid.com/

No_score linuxgeek71 who disagreed, says

sed/awk with a shell script works just as well.

Make a related claim 9 months ago (link)
http://creativepony.com/

2 Blueberry who disagreed, says

That's simple?!

Make a related claim 9 months ago (link)
http://darch.myopenid.com/

6 D'Archangel who agreed, says

Pretty simple, yeah. Though he missed a simplifying trick by using '/' as the regex delimiter and '$^I' instead of '$INPLACE_EDIT'.

D'A

Make a related claim 9 months ago (link)
http://mwgamera.name/

1 mwgamera who disagreed, says

Okay, changed my vote. It's good but definitely not the best. Perhaps we all tend to overuse tools we know instead of learning to use more appropriate ones.
Btw, about 1 year ago when commenting I probably meant plain ed not sed since this is in place edit.

Make a related claim about 1 month ago (link)
Sign in in to leave a comment.