Find unicode characters in file

Find unicode or non-ascii characters using grep.

$ cat myfile.txt 
Lorem
ipsūm
dolor
sit
amet,
pōnderum
tritani
onstituto
in
duo.

Find line numbers

$ grep --line-number --perl-regexp '[^\x00-\x7F]+' myfile.txt 
2:ipsūm
6:pōnderum

Find characters

$ grep --line-number --only-matching --perl-regexp '[^\x00-\x7F]+' myfile.txt 
26

Use grep to find unicode characters

$ grep "$(printf %b '\u2013')" myfile.txt

Find unicode characters in vim

/\%u2013
Did this help you? Please let me know with a comment. Thank you
Posted .

Comments (RSS)

Leave a comment