1. Clean up trailing whitespace

    9 August 2011

    One line command to clean up the trailing whitespace for a given project:

    find . -name "*.rb" -type f -print0 | xargs -0 sed -i '' "s/[[:space:]]*$//"
    

    This command will search for any files with the “rb” extension (Ruby files) and remove all trailing whitespace. This works in OSX, the command syntax might be different in Linux. Run this command from your project’s root.

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.