Remove Trailing Space from source files
This Stackoverflow user asked How To Remove Trailing Whitespace Of All Files Recursively.
This reply helped me to work around the fact that \s and \t are not supported in the mac version of sed:
find dir -type f -print0 | xargs -0 sed -i .bak -E “s/[[:space:]]*$//”
So using [:space:] can actually work for both tabs and spaces.
However, I ended up not using ‘find’ for the files, and then passing the files to sed directly:
sed -i ” ’s/[[:space:]]*$//g’ **/*.*
