perl -i.bak -e 'BEGIN{undef $/;} while (<>) { s//\n/; print }' foo*