Are there any tools / UNIX single liners which would remove trailing whitespaces for multiple files in-place.
E.g. one that could be used in the con
Unlike other solutions which all require GNU sed, this one should work on any Unix system implementing POSIX standard commands.
find . -type f -name "*.txt" -exec sh -c 'for i;do sed 's/[[:space:]]*$//' "$i">/tmp/.$$ && mv /tmp/.$$ "$i";done' arg0 {} +
Edit: this slightly modified version preserves the files permissions:
find . -type f -name "*.txt" -exec sh -c 'for i;do sed 's/[[:space:]]*$//' "$i">/tmp/.$$ && cat /tmp/.$$ > "$i";done' arg0 {} +