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]'


Re^2: awk...ward
by Fletch (Chancellor) 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. :-)