Skip to content

Instantly share code, notes, and snippets.

@anuragpeshne
Last active August 29, 2015 14:25
Show Gist options
  • Save anuragpeshne/634cbdfe277987bbcda7 to your computer and use it in GitHub Desktop.
Save anuragpeshne/634cbdfe277987bbcda7 to your computer and use it in GitHub Desktop.
remove trailing whitespace,sed
#!/bin/bash
# inplace substitution which works on both OSX and Linux
if [ -z $1 ]
then
echo "Fatal: enter file name"
else
sed -E 's/[ \t]+$//g' "$1" > /tmp/t_rm_wp
cp /tmp/t_rm_wp "./$1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment