A
alexxx.magni
<disclaimer: I'm not an expert at all in oneliners>
.... yet I sometimes use them to process datafiles.
And I often find it useful to use the -n switch to extract data, one
line at a time.
But what I'm really missing is the possibility to have an incremental
variable reminding me of which line I'm processing, e.g.:
perl -wne 'my $i=0;/(\S+)\s+(\S+)/;print "$i $2\n";$i++' e.dat
of course it doesnt work, but I'd like to have a way for $i to be
incremented - there is a hope of accomplishing this?
thanks!
alessandro
.... yet I sometimes use them to process datafiles.
And I often find it useful to use the -n switch to extract data, one
line at a time.
But what I'm really missing is the possibility to have an incremental
variable reminding me of which line I'm processing, e.g.:
perl -wne 'my $i=0;/(\S+)\s+(\S+)/;print "$i $2\n";$i++' e.dat
of course it doesnt work, but I'd like to have a way for $i to be
incremented - there is a hope of accomplishing this?
thanks!
alessandro