awk assistance
pll at lanminds.com
pll at lanminds.com
Wed Nov 13 13:03:42 EST 2002
In a message dated: Wed, 13 Nov 2002 10:53:45 EST
"Price, Erik" said:
>I have a file that contains the redirected output of a big "find"
>command. I want to learn how to quickly scan this file for unique
>file names, and while I could write a lengthy Perl one-liner,
Why must it be lengthy?
find ./ -type f | perl -F'/' -ane 'print "$F[$#F]";'
seems to do the trick just fine. And if you want to weed out
duplicates pipe the output through 'uniq' with your choice of swiches.
>I was wondering if it could be done more simply with awk.
I'd say it's about the same difficulty level
>But since I have never used awk, I was hoping someone could show me The Way.
I'd argue that 'awk' is "The Old Way" and has been replaced by Perl
as "The Way" :)
Awk does have it's occasional uses, but for all intents and purposes,
has been replaced by perl for 99% of the tasks awk was designed for.
Awk has a lot of limitations which don't exist in perl, like line
length (1024 characters?), etc.
--
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