Last active
April 5, 2017 21:30
-
-
Save franzejr/9d42f6298c85bff0659c to your computer and use it in GitHub Desktop.
Removing trailing whitespace recursively from your project
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
#Removing trailing whitespace from .rb files | |
find -name '*.rb' -print0 | xargs -r0 sed -e 's/[[:blank:]]\+$//' -i | |
#Removing trailing whitespace from .erb files | |
find -name '*.erb' -print0 | xargs -r0 sed -e 's/[[:blank:]]\+$//' -i | |
# WORKING ON OSX | |
find . \( -name '*.rb' -or -name '*.js' -or \\n-name '*.css' -or -name '*.scss' -or -name '*.erb' -or -name '*.yml' -or -name '*.erb' \) \\n-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