Skip to content

Instantly share code, notes, and snippets.

@schlueter
Last active November 9, 2015 19:07
Show Gist options
  • Save schlueter/5c350d8f23589f3f4d1e to your computer and use it in GitHub Desktop.
Save schlueter/5c350d8f23589f3f4d1e to your computer and use it in GitHub Desktop.
Source cleanup on OS X
# Remove trailing whitespace
find . -not \( -name .git -prune \) -type f -print0 | LC_ALL=C xargs -0 sed -i '' -E "s/[[:blank:]]+$//"
# Add newline @ eof if missing
find . -type f -print0 | LC_ALL=C xargs -0 sed -i -e '$a\' file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment