in reply to Remove Blank Lines Off the End of a File
The changes are made in-place so change -i to -i.bak if you want to keep a backup. perl -i -ne '/^$/ ? $i++ : do{print "\n" x $i, $_; $i=0}' file Update: I just ran PrakashK's program on the same test data. It took 0.1 sec!!
--
John.
|
|---|