Subject:
|
Re: awk vs. perl for simple tasks
|
Newsgroups:
|
lugnet.off-topic.geek
|
Date:
|
Wed, 5 May 1999 22:30:58 GMT
|
Reply-To:
|
JSPROAT@GEOCITIES.COMantispam
|
Viewed:
|
451 times
|
| |
| |
Todd Lehman wrote:
> 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
Hmmm... I *think* a2p handles this by giving the perl script the
"while(<>)" loop. I don't think perl will do that by itself.
> BTW, I think Larry Wall once commented or wrote something to the effect of,
> "awk still has to be better than perl at something."
Check perlvar, in the section on $/ (input record separator) -- in Perl, it
can only be a regular string, but in awk, it can be a re.
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. :-,
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 has 1 Reply: | | 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 (...) (26 years ago, 6-May-99, to lugnet.off-topic.geek)
|
Message is in Reply To:
| | awk vs. perl for simple tasks
|
| (...) 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 (...) (26 years ago, 5-May-99, to lugnet.faq, lugnet.off-topic.geek)
|
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
|
|
|
|