http://qs321.pair.com?node_id=40814


in reply to perl

A one-liner that will do this:
perl -ne '$count++ unless /\S/; print "$count\n" if eof' <filename

Replies are listed 'Best First'.
Re^2: perl
by Random_Walk (Prior) on Sep 03, 2004 at 07:49 UTC
    A slightly shorter version perl -pe '$c++ unless /\S/}{$_=$c' Cheers,
    Random.