-
-
Save artgillespie/1392258 to your computer and use it in GitHub Desktop.
Remove trailing whitespace from all source files under the current dir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Removes trailing whitespace from all source files in the current directory and its children. | |
# Note the `-i .bak` switch to sed. This will create a backup copy alongside any modified files | |
# like `Somefile.cpp.bak` Simply remove the `.bak` argument to `-i` to prevent the backup | |
# files from being generated | |
# | |
/usr/bin/find . -type f -and \( -name '*.m' -or -name '*.h' -or -name '*.mm' -or -name '*.cpp' -or -name '*.c' \) -and -print0 | xargs -0 sed -i .bak -E "s/[[:space:]]+$//" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment