tinyapps.org

grep not returning text known to be in file (opens in new tab)

Symptom cat displays text, but grep can't find it: % cat foo.txt The world is overcome--aye! even here! By such as fix their faith on Unity. % grep fix foo.txt % Cause The file is UTF-16, not UTF-8/ASCII. For example, in UTF-16LE, fix is encoded as: 66 00 69 00 78 00 not as the contiguous ASCII bytes, which are also the UTF-8 bytes for fix: 66 69 78 So grep fix does not match. cat output may appear normal since NUL bytes are often not visibly rendered. Detect encoding % file foo.txt foo.txt: ...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help