How to remove trailing whitespace from a bunch of files 7 February 2011·44 words·1 min Debian Tips Table of Contents Linux files (and also Mac) Windows files Sed oneliners Table of Contents Linux files (and also Mac) Windows files Sed oneliners 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