linux,

Find non-ASCII characters in Linux

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

ASCII as a character encoding standard that use numbers to represent characters. The original ASCII code range is 0 - 127 (7 bits) which represents the english character set including special characters and symbols. Undeniably, this is not enough by today standards. Now, here’s comes the one-liner you could use to troubleshoot any parsing issues by finding all non-ascii characters in a file. Here’s the other OS-related posts:

Prerequisites

  • Shell environment

Solution

Run the following command:

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

Conclusion

If you have any questions, thoughts or opinions, feel free to leave a comment below. On a side note, follow our official channel on Telegram.