[Israel.pm] awk equivalent

Yuval Kogman lists at woobling.org
Mon Mar 22 12:16:58 PST 2004


On Mon, Mar 22, 2004 at 16:09:33 +0200, Yossi.Itzkovich at ecitele.com wrote:

> What is the Perl equivalent of:
> 
> 1. awk '{print $3}'  filename
> and
> 2. awk -Fc '{print $3}'  filename   ( "c" is single delimiter character)

a2p did not produce anything equivalent.

Something quite similar could be

perl -ne 'BEGIN { $\ = "\n" } print (split)[2]'

and

perl -ne 'BEGIN { $\ = "\n" } print (split(/c/))[2]';

but it sort of makes you want to see "neh".

Why not just use awk?

-- 
 ()  Yuval Kogman <nothingmuch at woobling.org> 0xEBD27418  perl hacker &
 /\  kung foo master: /me sneaks up from another MIME part: neeyah!!!!!




More information about the Perl mailing list