in reply to truncate only a last blank line

 perl -pi.bak -e 'BEGIN { $/ = undef }; s{ ^ \n \z }{}xms' *.txt

Replies are listed 'Best First'.
Re: Easy if you don't mind slurping.
by Aristotle (Chancellor) on Dec 30, 2005 at 05:29 UTC

    Neat.

    And you can shorten that some:

    perl -pi.bak -0777e's{ ^ \n \z }{}xms' *.txt

    Makeshifts last the longest.