The keys as it were are to note that \n\n is a blank line or if you read a file line by line then a blank line will match m/^\s*$/
perl -pi.bak -e 's/\n{2,}/\n/' file.txt
perl -pi -e 's/^\s*\z//' file.txt perl -ne 'print unless m/^\s*$/' file.txt > noblanks.txt
Updated as per sgifford's comments.
cheers
tachyon
In reply to Re: newlines in regular expressions
by tachyon
in thread newlines in regular expressions
by gitarwmn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |