Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Awk and Perl unique features

by JavaFan (Canon)
on Apr 16, 2010 at 09:42 UTC ( [id://835055]=note: print w/replies, xml ) Need Help??


in reply to Awk and Perl unique features

Somehow, I find awk '{print $3}' easier to type/remember than perl -anle 'print $F[2]'. That's about the only case I use awk for nowadays - and then I only use it in shell one-liners.

Of course, if I have to write a program in an environment that doesn't have perl available, I'd use awk. But last time that happened is a few years ago.

Replies are listed 'Best First'.
Re^2: Awk and Perl unique features
by Fletch (Bishop) on Apr 16, 2010 at 14:26 UTC

    That's why you setup your shell with abbrevs and all you have to type is ,p2 or what not to have it expanded into | perl -lane 'print $F[2]' for you when you hit the space key.

    (OK, technically I have ,2 which expands to | awk '{print $2}' which I use more often out of habit; but I've also got ,pa which expands out to | perl -lane, and thinking it over during the reply I may try making one that expands to | perl -lane 'print $F[~]' where the ~ is where the cursor is left after expansion a la TextMate snippets)

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://835055]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2026-04-11 12:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.