Find Files Containing Tab Characters or Trailing Spaces

find . -iname "*.c" -or -iname "*.h" | xargs grep -Pl '\t'

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 2022-10-13

  • miscellaneous_tips/20_software_development/grep_notes/find_files_containing_tab_characters_or_trailing_spaces.txt
  • Zuletzt geändert: 2022-10-13 17:22
  • von martin