Skip to main content
Topic: Remove whitespace from end of line in multiple files.  (Read 252 times) previous topic - next topic

Remove whitespace from end of line in multiple files.

Linux

Code: [Select]
find . -type f -name '*.txt' -exec sed --in-place 's/[[:space:]]\+$//' {} \+

macOS

Code: [Select]
find . -iname '*.txt' -type f -exec sed -i '' 's/[[:space:]]\{1,\}$//' {} \+