An application on my computer needs to read in a text file. I have several, and one doesn’t work; the program fails to read it and tells me that there is a bad character in it somewhere. My first guess is that there’s a non-ascii character in there somewhere, but I have no idea how to find it. Perl or any generic regex would be nice. Any ideas?
Share
You can use
[^\x20-\x7E]to match a non-ASCII character.e.g.
grep -P '[^\x20-\x7E]' suspicious_file