Skip to content

Instantly share code, notes, and snippets.

@alissonsales
Created December 6, 2011 18:54
Show Gist options
  • Save alissonsales/1439416 to your computer and use it in GitHub Desktop.
Save alissonsales/1439416 to your computer and use it in GitHub Desktop.
Removing trailing spaces
#!/bin/bash
if [ -f $1 ]
then
sed "s/[[:blank:]]*$//" "$1" > "$1.tmp"
mv "$1.tmp" "$1"
else
echo "File $1 does not exist.\n"
fi
@alissonsales
Copy link
Author

if anyone fucked up your project with trailing spaces all around get rid of it with: find app/ -type f -name "*.rb" remove_trailing_spaces {} ";"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment