Find all files with the extension .txt in the root directory and use xargs to run the sed command to remove all trailing whitespace from the files.
find / -name '*.txt' | xargs sed -i '' -e 's/[[:space:]]*$//'