Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: awk...ward

by jdporter (Paladin)
on Feb 24, 2005 at 19:38 UTC ( [id://434214]=note: print w/replies, xml ) Need Help??


in reply to awk...ward

perl -lane "print $F[1]"

See perldoc perlrun.

Update: On Windows, you have to use double-quotes to enclose a command-line script. On Unix, there'll be a problem with the double-quotes and the dollar sign. Therefore, on Unix, I'd recommend using single-qoutes if possible; or otherwise, escape the dollar sign.

Replies are listed 'Best First'.
Re^2: awk...ward
by dave_the_m (Monsignor) on Feb 24, 2005 at 20:34 UTC
    perl -lane "print $F[1]"
    or if we're golfing here,
    perl -lape'$_=$F[1]'

    Dave.

Re^2: awk...ward
by Fletch (Bishop) on Feb 24, 2005 at 19:45 UTC

    Missed it by that much.</Maxwell Smart> YM $F[0]; awk's fields are 1-based ($0 being the entire line).

      D'oh. Well, I'm not ashamed to admit my awk skills are a little rusty. Perl has been my text processing tool of first resort for the last... oh, 11 years. :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-19 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found