This might do what you want. It’s meant to be invoked as a command line tool per file and it sends its results to STDOUT. It’s essentially a one-liner unrolled to a script. You can put in an -i flag to edit the file in place but this is risky. Don’t do it unless you have backups and are going to check everything. Save it as, space-collapser.pl or whatever you like–
Update: I don’t have a lot of experience with WIN on this front… I’m, not sure this will work for you as is.
space-collapser.pl file dir-with-files/*#!/usr/bin/env perl -0777 -p # -0777, idiom for "slurp" mode. # Strip all trailing spaces including blank lines with spaces. s/[^\n\r\S]+(?=\r?\n)//g; # Reduces all triple or greater line spacing to double spaced lines. s/((?:\r?\n){2})(?:\r?\n)+/$1/g; # -p print at the end of each implicit loop.
In reply to Re: Remove whitespace between lines
by Your Mother
in thread Remove whitespace between lines
by wrkrbeee
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |