miscellaneous_tips:20_software_development:grep_notes:find_text_files_containing_trailing_spaces

Find Text Files Containing Trailing Spaces

find . -iname "*.c" -or -iname "*.h" | xargs egrep -l ' +[[:cntrl:]]*$'

The expression [[:cntrl:]]* is used to make sure this also works for files with DOS/Windows line endings, i.e. a CR before the LF.


Martin Burnicki martin.burnicki@burnicki.net, last updated 2023-04-17

  • miscellaneous_tips/20_software_development/grep_notes/find_text_files_containing_trailing_spaces.txt
  • Zuletzt geändert: 2023-04-17 16:08
  • von martin