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

Search functionality #8

Open
raspi opened this issue Aug 4, 2020 · 2 comments
Open

Search functionality #8

raspi opened this issue Aug 4, 2020 · 2 comments
Assignees
Labels
discussion Further information is requested enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@raspi
Copy link
Owner

raspi commented Aug 4, 2020

Add --search or --find parameter for searching bytes. Highlight the found bytes with some color and/or add bold/underline effect.

Example:

heksa --search 'Hello' hello.txt

Also what about case (in)sensitivity?

Maybe also add search option where you can use a file as search source:

heksa --search-file find-this.dat hello.txt

This will probably require double buffered io.Reader with moving search "window". The first will read for example 1024 bytes of file and mark the found search position offsets. The second is the currently used one which reads width bytes and needs to be changed to read from the bigger buffer. This changes the reader's current functionality a lot and needs some rewrites.

Other considerations:

Hex search where only [0-9a-f ] can be used in the search string:

heksa --search-hex '00010203040506...' hello.txt
heksa --search-hex '00 01 02 03 04 05 06 ...' hello.txt
@raspi raspi added enhancement New feature or request help wanted Extra attention is needed discussion Further information is requested labels Aug 4, 2020
@raspi raspi added this to the future milestone Aug 4, 2020
@raspi raspi self-assigned this Aug 4, 2020
@merces
Copy link

merces commented Aug 12, 2020

Interesting stuff. I've never seen it in a CLI hexa viewer. When I need it, I use | grep to look for the bytes I want but of course this is not the smarter way to do this and it's very error prone.

The text search could also consider finding both ASCII and Unicode strings.

@raspi
Copy link
Owner Author

raspi commented Dec 30, 2022

Initial reader prototype - https://github.com/raspi/searchreader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Further information is requested enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants