Forum Moderators: coopster & phranque
perl -i -wpe 's/\n+/\n/g' myfile
maybe this will do it for you: perl -00 -pi -e1 myfile
That doesn't take into consideration the possibility of linefeed characters preceeding the newline characters.
perl -i -wpe 's/(?:(\r?)\n)+/$1\n/g' myfile
[edited by: DrDoc at 4:21 am (utc) on Mar. 22, 2008]