macos,

Find non-ASCII characters in MacOS

May 28, 2022 · 1 min read · Post a comment
Find non-ASCII characters in MacOS

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
  • Brew

Solution

Step 1. Install the GNU verion of grep.

brew install grep

Note: Although grep is installed by default as part of the 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.