'xxd usage (change magic byte to JPEG)
I create a simple test file like this:
$ cat > test
blah
Now I run vi, and then :%!xxd to edit first bytes with FFD8 FF
00000000: ffd8 ffe0 0a blah.
and the I run :%!xxd -r.
file gives me NOT jpeg:
$ file test
test: Unicode text, UTF-8 text
And if I manage to get hexdump:
$ xxd test
00000000: c3bf c398 c3bf c3a0 0a .........
What am I doing wrong with xxd? Thank you
Solution 1:[1]
When opening the file with vi, please make sure to say:
LC_ALL=C vi test
then edit and save the file with the shown procedure.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | tshiono |
