How to remove trailing whitespace from a bunch of files
Feb 7, 2011
1 minute read

How to remove trailing whitespace from a bunch of files

Linux files (and also Mac)

find . -name '*.js' -exec sed -i 's/[[:blank:]]*\n$/\n/g' '{}' \;

Windows files

find . -name '*.js' -exec sed -i 's/[[:blank:]]*\r$/\r/g' '{}' \;

Sed oneliners

http://sed.sourceforge.net/sed1line.txt



comments powered by Disqus