Detect Non-ASCII Characters in Text Files

The grep utility can be used to detect non-ASCII characters in text files, e.g. in programming code:

LANG= grep --color='auto' -P -n '[^\x00-\x7F]' *.c *.h

:!: Please note the LANG= term used above overrides the localization / language configured for the console. There have been cases where the grep command didn't work as expected if a specific localization was configured.

Martin Burnicki martin.burnicki@burnicki.net 2019-04-26

  • miscellaneous_tips/20_software_development/grep_notes/detect_non-ascii_characters_in_text_files.txt
  • Zuletzt geändert: 2023-08-30 15:57
  • von martin