My web app is displaying some bizarro output (unicode characters that shouldn't be there, etc.). The best I can reckon is that somehow I introduced a bad char somewhere in the source, but I can't figure out where.
I found <a href="https://stackoverflow.com/a/17168847" rel="nofollow">this answer</a> that states I can do something like:
grep -obUaP "<\x-hex pattern>" .
When I copy the unicode char out of the browser and into my <a href="http://home.gna.org/bless/" rel="nofollow">Bless</a> hex editor, it tells me that the exact bytes of the char are:<blockquote>
15 03 01 EF BF BD 02 02</blockquote>
How can I format
<\xhex pattern> to match the exact bytes that I need. I tried:
grep -obUaP "<\x-15 03 01 EF BF BD 02 02>" .
But that doesn't work. Thoughts?Answer1:
Check the post again. FrOsT is not including the '<' and '>' in his actual grep command. He only used the carats to enclose an example statement. His actual statement looks like this:
I have a C source file on my computer that begins with the line:
When I run
grep -obUaP '\x69\x6E\x63\x6C\x75\x64\x65' io.c
That is, the line number followed by <em>only</em> the string matching the pattern.
You may want to run
and find out what all those options mean.