in reply to awk like question in perl

Perl comes with a program called "a2p" that will translate awk scripts into perl equivalents.

For your example, this should do what you want:

perl -na 'print "@F[0,1,5]\n"'

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: awk like question in perl
by drock (Beadle) on Aug 11, 2004 at 21:13 UTC
    ok so how would I use this against a perl script ? is it
    perl -na script.pl 'print "@F[0,1,5]\n"'

      No. You'd either pipe the output of one script through the other:

      perl script.pl | perl -nae'print "@F[0,1,5]\n"'

      which is the same as doing it with awk.

      Or you'd have to edit script.pl to change the statements that print its output to do what you want.

      Makeshifts last the longest.