# Be sure to specify files instead of * when running the script. perl -p -i -e "s/ +$//g" *