macos,

Find non-ASCII characters in macOS

May 28, 2022 · 1 min read · Post a comment

In these modern days, ASCII as a character encoding standard is a subset of UTF-8. As for the other OS-related posts refer to:

Prerequisites

  • Shell environment
  • Homebrew

Solution

Step 1. Install the GNU version of grep.

brew install grep

Note(s): Although grep is installed by default as part of coreutils, brew doesn’t automatically replace it, instead it adds a prefix g, so you can call it as ggrep.

Step 2. Run the following command:

ggrep --color='auto' -P -n "[\x80-\xFF]" somefile.txt

Conclusion

Any questions, thoughts or opinions will be appreciated in the comment section below. On a side note, follow our official channel on Telegram.