Skip to content

Instantly share code, notes, and snippets.

@kissgyorgy
Created February 20, 2014 01:25
Show Gist options
  • Save kissgyorgy/9105171 to your computer and use it in GitHub Desktop.
Save kissgyorgy/9105171 to your computer and use it in GitHub Desktop.
Bash: delete trailing spaces
#!/bin/bash
# On OS X 10.9 (see: http://stackoverflow.com/questions/19242275/sed-re-error-illegal-byte-sequence-on-mac-os-x)
# export LC_CTYPE=C
# export LANG=C
# http://stackoverflow.com/questions/149057/how-to-remove-trailing-whitespace-of-all-files-recursively
find . -not \( -name .svn -prune -o -name .git -prune \) -type f -print0 | xargs -0 sed -i '' -E "s/[[:space:]]*$//"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment