How Did I Fix That?

A log of solutions to problems I've encountered. No warranties.

Searching for non-ASCII characters in a file

03 December 2019

Most online solutions involve grep -P -n "[\x80-\xFF]" but these solutions do not work on Mac OS X or BSD variants of grep. Instead, use Perl for a more portable solution:
perl -ne 'print if /[^[:ascii:]]/' filename.txt

Tags: software, textprocessing, Unix, MacOS