|
In lugnet.faq, jsproat@geocities.com (Sproaticus) writes:
> > Save this page to a file, and then to get a list of non-ng directories,
> > simply do:
> > cat filename | gawk -v FS="\t" '!$3'
> > etc....
>
> Todd, I'm shocked! Awk? In a Perl world? :-,
Yup! It's a Perl world, but awk is still a great thing! It's hardly my
favorite general-purpose programming language, but other than grep and sort
and cat and uniq, it's by far my favorite command-line pipe.
I think perl has a command line option to process STDIN line-by-line in a
simple way (i.e. short number of keystrokes) like awk does, but I've never
bothered to look it up since awk is pretty deeply stuck in my brain, and awk
is significantly faster than perl for certain types of simple line-by-line
tasks.
But if it doesn't fit on one line (OK, sometimes a long line :), I make it a
Perl program.
BTW, I think Larry Wall once commented or wrote something to the effect of,
"awk still has to be better than perl at something."
--Todd
[followups set to lugnet.off-topic.geek]
|
|
Message has 2 Replies: | | Re: awk vs. perl for simple tasks
|
| (...) Hmmm... I *think* a2p handles this by giving the perl script the "while(<>)" loop. I don't think perl will do that by itself. (...) Check perlvar, in the section on $/ (input record separator) -- in Perl, it can only be a regular string, but (...) (26 years ago, 5-May-99, to lugnet.off-topic.geek)
| | | Re: awk vs. perl for simple tasks
|
| (...) That's in reference to the awk idiom: awk '{ print $4 }' which is much longer to do in perl. I personally use this as a shell command inside Emacs all the time. I'm not good at perl one-liners. -Tim (26 years ago, 15-May-99, to lugnet.off-topic.geek)
|
Message is in Reply To:
21 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|