in reply to Number Line while reading by chunks

Maybe the easiest way is to count the lines on your own?
perl -ne 'BEGIN {our $n=1; $/="";}; print "=Line:$n, Record:$.==\n$_"; + $n += y/\n/\n/;'< textfile
Update: Oops, missed something when doing the test. Code above corrected. This was formerly
perl -ne '$/=""; $F{1} += y/\n/\n/ -1; print "=Line:",$F{1},", Record: $.==\n$_==\n"; ' < textfile
Sorry for that.

Replies are listed 'Best First'.
Re^2: Number Line while reading by chunks
by ambs (Pilgrim) on Aug 22, 2008 at 18:22 UTC

    Yup, that was what I was thinking on. But you know, Perl has so many variables and tweaks, that I might be forgetting something.

    Thanks ;)

    Alberto Simões