Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ability to "tail" the file (and +/- seek) #14

Closed
coolaj86 opened this issue Feb 24, 2020 · 4 comments
Closed

ability to "tail" the file (and +/- seek) #14

coolaj86 opened this issue Feb 24, 2020 · 4 comments
Labels
enhancement New feature or request stale

Comments

@coolaj86
Copy link

coolaj86 commented Feb 24, 2020

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

@sitkevij sitkevij added the enhancement New feature or request label Mar 17, 2020
@sitkevij
Copy link
Owner

sitkevij commented Nov 14, 2020

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

@0xflotus
Copy link
Contributor

0xflotus commented Jan 25, 2022

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

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?

Copy link

This issue has been marked stale due to no recent activity.

@github-actions github-actions bot added the stale label Dec 13, 2023
Copy link

This issue was closed due to no activity for an extended period.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

3 participants