in reply to print if // line number?

What you said it does, in case that's what you want:

perl -ne'print "$.\t$_" if /GRHL3/'

What it actually does (only the second field is checked for the pattern):

perl -ane'print "$.\t$_" if $F[1] =~ /GRHL3/'

$. is in perlvar, and -n and -a are in perlrun.

Replies are listed 'Best First'.
Re^2: print if // line number?
by ZWcarp (Beadle) on Jun 08, 2011 at 00:52 UTC

    Shoot you're right sorry...yeah I meant with out the $2 (specifying the field) ...just across the whole line