in reply to Double blank lines to single blank line

Dangerous (be sure to have an independent backup before you read on):

If you want to edit the data in place, you could use

perl -ibak -we 'local $/ = "\n\n"; while (<>) { local $/ = "\n"; chomp +; print }' ./data.dat

Be aware that it'll apply the changes immediately, but will create a backup of the file edited with the extension .bak. Furthermore, this approach assumes that your _entire_ input file looks like the excerpt you provided. Bear in mind that otherwise perhaps, chaos will ensue.

Replies are listed 'Best First'.
Re^2: Double blank lines to single blank line
by Util (Priest) on May 11, 2007 at 01:12 UTC
    Yet another quick method, via "paragraph mode":
    perl -00 -wpe 1 data.dat >data_singled.dat
    See perlrun for the meanings of the flags.