[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: more on 1 liner perl/awk



hi ya

On Mon, 10 Mar 2003, Osamu Aoki wrote:

> So here is similar one  liners but ...
> 
> awk '{ print $3 }'        # extract third field separated by space
> 
> awk -F'\t' '{ print $3 }' # extract third field separated by tab
> 
> awk -F'\t' '($3=="111")' 
> perl -ne 'print if (split('\t'))[2]==111'
>        # extract lines where third field is "111" separated by tab
> 
> awk '($2=="1957") { print $3 }' 
>        # extract third field where the second field is "1957"
> 
> For the last awk, I can not do the same with perl one liner.

it's late... why not make fun of myself...

i say its ( a wild guess )

perl -ne 'print (split('\t'))[2] if (split('\t'))[1]==1957' ;

nite-nite
alvin



Reply to: