hex
hex copied to clipboard
ability to "tail" the file (and +/- seek)
Is your feature request related to a problem? Please describe.
Usually when I'm using a hex editor it's because I'm having trouble parsing or packing something. I often need a quick look at the first n
bytes of the file as well as the last n
bytes of the file to see if something is wrong with the header or an offset.
If it's a large file, I might try to bisect by picking a random offset and see the general area where the issue reference and test data have become out of sync.
Describe the solution you'd like
I'd love to have a -t <n>
option for tailing the last n
bytes of a file.
I'd also love a --seek <+/-n>
option to complement -l
.
Describe alternatives you've considered
For positive or forward seeking I suppose I could use something like dd if=./my/file.bin iseek=100 bs=1 count=2 | hx
.
Additional context N/A
hi @coolaj86,
I believe its possible to perform both tail
and dd
seek functions by using existing utility tools and passing to hx
stdin:
tail
❯ tail -c 16 README.md | hx
0x000000: 0x65 0x66 0x3d 0x62 0x61 0x64 0x67 0x65 0x5f 0x6c ef=badge_l
0x00000a: 0x61 0x72 0x67 0x65 0x29 0x0a arge).
bytes: 16
seek (dd)
❯ dd if=README.md iseek=12 bs=1 count=32 | hx
32+0 records in
32+0 records out
32 bytes transferred in 0.000062 secs (516222 bytes/sec)
0x000000: 0x46 0x75 0x74 0x75 0x72 0x69 0x73 0x74 0x69 0x63 Futuristic
0x00000a: 0x20 0x74 0x61 0x6b 0x65 0x20 0x6f 0x6e 0x20 0x68 take on h
0x000014: 0x65 0x78 0x64 0x75 0x6d 0x70 0x2e 0x0a 0x0a 0x60 exdump...`
0x00001e: 0x68 0x65 he
bytes: 32
hi @coolaj86,
I believe its possible to perform both
tail
anddd
seek functions by using existing utility tools and passing tohx
stdin:tail
❯ tail -c 16 README.md | hx 0x000000: 0x65 0x66 0x3d 0x62 0x61 0x64 0x67 0x65 0x5f 0x6c ef=badge_l 0x00000a: 0x61 0x72 0x67 0x65 0x29 0x0a arge). bytes: 16
seek (dd)
❯ dd if=README.md iseek=12 bs=1 count=32 | hx 32+0 records in 32+0 records out 32 bytes transferred in 0.000062 secs (516222 bytes/sec) 0x000000: 0x46 0x75 0x74 0x75 0x72 0x69 0x73 0x74 0x69 0x63 Futuristic 0x00000a: 0x20 0x74 0x61 0x6b 0x65 0x20 0x6f 0x6e 0x20 0x68 take on h 0x000014: 0x65 0x78 0x64 0x75 0x6d 0x70 0x2e 0x0a 0x0a 0x60 exdump...` 0x00001e: 0x68 0x65 he bytes: 32
You're absolutely right. But you lose the ability to see the byte range in column one. If you need it for orientation, it would be better, hx would have this feature. Isn't it?
This issue has been marked stale due to no recent activity.
This issue was closed due to no activity for an extended period.