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

Terry td3201 at yahoo.com
Tue Nov 25 20:25:04 UTC 2003


Interesting:
[rockstar at theshow local]$ ls -l /usr/bin/perl
-rwxr-xr-x    2 root     root        12800 Oct 15
10:17 /usr/bin/perl
[rockstar at theshow local]$ ls -l /bin/sed
-rwxr-xr-x    1 root     root        87260 Oct 25
00:12 /bin/sed

[rockstar at theshow local]$ rpm -qf /bin/sed
sed-4.0.8-1
[rockstar at theshow local]$ rpm -qf /usr/bin/perl
perl-5.8.1-92

[rockstar at theshow local]$ file /bin/sed
/bin/sed: ELF 32-bit LSB executable, Intel 80386,
version 1 (SYSV), for GNU/Linux 2.2.5, dynamically
linked (uses shared libs), stripped
[rockstar at theshow local]$ file /usr/bin/perl
/usr/bin/perl: ELF 32-bit LSB executable, Intel 80386,
version 1 (SYSV), for GNU/Linux 2.2.5, dynamically
linked (uses shared libs), stripped

Fedora Core 1.



--- Sean Kelly <smkelly at zombie.org> wrote:
> On Tue, Nov 25, 2003 at 11:46:19AM -0800, Terry
> wrote:
> > Another point to make here is the perl binary is
> 1/4
> > the size of the sed binary....
> 
> ?!?!
> -r-xr-xr-x  1 root  wheel   24960 Oct 28 21:11
> /usr/bin/sed
> -rwxr-xr-x  1 root  wheel  844604 Oct 29 00:24
> /usr/local/bin/perl
> 
> The perl binary is 33x bigger than sed on my
> machine.
> 
> /usr/bin/sed: ELF 32-bit LSB executable, Intel
> 80386, version 1 (FreeBSD),
> for FreeBSD 5.0.1, dynamically linked (uses shared
> libs), stripped
> 
> /usr/local/bin/perl: ELF 32-bit LSB executable,
> Intel 80386, version 1
> (FreeBSD), for FreeBSD 5.0.1, dynamically linked
> (uses shared libs), stripped
> 
> 
> > 
> > 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
> > _______________________________________________
> > OLUG mailing list
> > OLUG at olug.org
> > http://lists.olug.org/mailman/listinfo/olug
> 
> -- 
> Sean Kelly         | PGP KeyID: D2E5E296
> smkelly at zombie.org | http://www.zombie.org
> _______________________________________________
> 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