[OT] - subthread - perl vs sed Re: [olug] Text search and Replace

Terry td3201 at yahoo.com
Tue Nov 25 19:46:19 UTC 2003


Another point to make here is the perl binary is 1/4
the size of the sed binary....

Since we are getting to the rediculous point of this
discussion, I thought it was appropriate.  :)


--- Jay Hannah <jay at jays.net> wrote:
> 
> On Tuesday, November 25, 2003, at 11:20 AM, Brian
> Roberson wrote:
> > While I am a huge fan of perl, I must say that it
> is overkill on 
> > things like
> > this, say you had directory with 50,000 files...
> just think about 
> > spawning
> > perl 50,000 time's vice sed plus the overhead that
> perl would add if 
> > the
> > files where 10Mb+ in size. AFAIK - perl would load
> 10Mb into resident 
> > mem
> > before even doing the substitution. sed uses the
> file control function 
> > fseek
> > when you give it a filename instead of standard
> out.
> 
> Blasphemer!  -grin-
> 
>     perl -i -e 's/foo/bar/g' myfiles*.txt
> 
> Does not spawn 50,000 perl's. There's just one perl
> whacking the 50,000 
> files. You could very well be right about 10MB of
> resident mem. But if 
> you don't have 10MB of memory free do you really
> have an appropriate 
> server for whacking 50,000 10MB+ files? -grin-
> 
> I'd take the time to benchmark the speed of "perl
> -i" vs. sed, but I'm 
> too lazy*.
> 
> Call me a zealot, but IMHO it's a good idea to learn
> Perl once rather 
> than learning sed _and_ awk. Learn one thing instead
> of two, plus you 
> can then do sooo much more than both combined. Ah,
> Perl. The Swiss Army 
> Chainsaw of text processors**.
> 
> Jay Hannah
> Local Perl Zealot
> Omaha Perl Mongers: http://omaha.pm.org
> 
> * ... and impatient, and full of hubris. -grin-
> ** ... and database manipulators, network service
> creator/consumers, 
> etc...
> 
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug


=====
Terry

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


More information about the OLUG mailing list