To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 14
13  |  15
Subject: 
Re: awk vs. perl for simple tasks
Newsgroups: 
lugnet.off-topic.geek
Date: 
Thu, 6 May 1999 14:52:48 GMT
Reply-To: 
jsproat@geocities.IHATESPAMcom
Viewed: 
393 times
  
Todd Lehman wrote:
In lugnet.off-topic.geek, jsproat@geocities.com (Sproaticus) writes:
Personally, I'd undef $/, snarf the entire file, and do a split with an re
on it.  But then, I'm not so familiar with awk.  :-,
That's good if you're snarfing up relatively small files, but what if you're
processing 100 megabytes of STDIN -- say, looking through an httpd log?  And
live tail -f even?  :)

Hmmm, I don't think I'm old enough for that yet.  :-D  I've just picked up
Perl relatively recently.

I'd hesitate to do a 100 Mb STDIO pipe on any MS platform.  In DOS and
Win16/95/98 (which are single-tasking OS's no matter what MS tells you), the
pipe is handled by writing to a temp file, then giving the process a handle
to that file in place of STDIN.  So, a command such as "type foo.log | sort
| etc" on a 100 Mb file would be bulky; the "| sort |" part would create
*two* 100 Mb temp files.  And that's with just two pipes.  :-P

I'm not sure how this is handled on NT (my current platform).  Since it was
designed by IBM, was multitasking from day one, is capable of IPC from the
kernel level up, and was given an POSIX layer, I would hope that STDIO pipes
are handled properly (i.e. using real pipes).  I haven't seen any
documentation on this, though.  Arg.  >:-P

...So, I'd rather slurp in the entire 100 Mb file, and let the VM take it on
the face.  My attitude will probably change once I get my hands on Linux.
:-,

Cheers,
- jsproat

--
Jeremy H. Sproat <jsproat@geocities.com>
http://www.geocities.com/SiliconValley/Horizon/5249/
"I prefer the term para-mental.  It keeps me out of the loony bin."



Message is in Reply To:
  Re: awk vs. perl for simple tasks
 
(...) Aha, here it is: perl -ane (...) FS is awk is the field separator, not the record separator. The record separator in awk is RS. Hmm, doesn't look like Perl has an input field separator -- only an output field separator $, and input/output (...) (25 years ago, 6-May-99, to lugnet.off-topic.geek)

21 Messages in This Thread:








Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR