perl -i -pe'BEGIN { undef $/ } s/\n\+//g' filename