awk assistance

pll at lanminds.com pll at lanminds.com
Thu Nov 14 13:04:19 EST 2002


In a message dated: Wed, 13 Nov 2002 20:28:49 EST
bscott at ntisys.com said:

>  Generally true, I expect, but there are still reasons to use awk.  

Agreed! 

>> Awk has a lot of limitations which don't exist in perl, like line length
>> (1024 characters?), etc.
>
>  FWIW, I believe gawk has removed many of those.  Of course, if you've got
>the GNU tools, there is little reason not to have Perl, too.  :)

True, but didn't the OP say they were on Solaris without access to 
the GNU tools? (maybe I'm confusing discussions).

>  Also FWIW, this awk code
>
>	awk -F/ '{ print $NF }'
>
>appears to run about 4 times faster than this Perl code
>
>	perl -F'/' -ane  'print "$F[$#F]";'

You know, I was trying to make that determination yesterday, but kept 
getting interupted, and therefore never got around to it :)

Thanks!

>, at least in my quick tests.  I mention this out of curiosity more than
>anything else; I highly doubt the performance difference could ever matter
>in practice.

Probably not, but, it also depends upon the application.  If this 
type of thing were being done from a web app running from a CGI, it 
might turn out to be faster with perl if the use mod_perl than 
spawning a new awk instance every time.  (purely speculation on my 
part).

-- 

Seeya,
Paul
--
	It may look like I'm just sitting here doing nothing,
   but I'm really actively waiting for all my problems to go away.

	 If you're not having fun, you're not doing it right!





More information about the gnhlug-discuss mailing list