Quote:
Well, like I said, that command will work. A more optimized one might be:
Code:
perl -pe 'BEGIN { $RS = undef; } chomp;' < file > newfile

or even:
Code:
perl -pie 'BEGIN { $RS = undef; } chomp;' file



IIRC, chomp() removes $RS, and, since you've set that to undef to slurp the whole file, chomp is a no-op -- see 'perldoc -f chomp' -- so I'm guessing this wouldn't modify the file at all. Not to mention, in the -pie version, the -i flag takes a parameter, which sucks up the 'e' flag. You need to use "perl -pi -e", instead. On the subject of flags, you'll also want "-MEnglish" -- $RS is in the English module.

Code:
perl -e'{local $/=undef; @a=<>;}chomp $a[-1];print @a' < file > newfile


or
Code:
perl -pi -e'BEGIN{$/=undef;}s/\n$//' file


One caveat to epwc -- both of these slurp the entire file into memory, so if the attached example file was only a snippet of a very large file, you may not want to use this method.