How Do I grep For non-ASCII Characters in UNIX
Posted
by Peter Conrey
on Stack Overflow
See other posts from Stack Overflow
or by Peter Conrey
Published on 2010-06-08T20:48:13Z
Indexed on
2010/06/08
20:52 UTC
Read the original article
Hit count: 229
I have several very large XML files and I'm trying to find the lines that contain non-ASCII characters. I've tried the following:
grep -e "[\x{00FF}-\x{FFFF}]" file.xml
But this returns every line in the file, regardless of whether the line contains a character in the range specified.
Do I have the syntax wrong or am I doing something else wrong? I've also tried:
egrep "[\x{00FF}-\x{FFFF}]" file.xml
(with both single and double quotes surrounding the pattern).
© Stack Overflow or respective owner