<[EMAIL PROTECTED]> asked:
> How can I print certain fields delimited by ' '?
> In awk I would write awk '{print $1, $6}' filename

In Perl, that would be

        perl -lane 'print "$F[0] $F[1] $F[5]"' filename

See the perlrun manpage about all of the command line
switches. Here I use

-e - run Perl code specified in the following argument
-n - assume a basic loop like while(<>){ ... } around
     the Perl code.
-l - Add a cr/lf (or whatever is suitable) to each print
-a - run in autosplit mode, i.e. split each input line
     to the @F array.

HTH,
Thomas

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to