ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I accidentally deleted a directory, most files that were modified since the last backup have been recovered using "foremost" but there are about 4 to 6 files "foremost" or "scalpel" did not find including one that was just created (no backup), I'd like to recover them if there is any chance, they are all text files in an ext4 partition and I know specific words used in the file that has no backup. I have also copied (with dd) the entire 5G partition to a file (called devsda9) in a larger partition with the same file system.
It seems I could recover with "hexedit", I had a look at the man page but it is too complex to learn, I have never used it and normally have no use for that sort of software.
My question is: can I search the file "devsda9" (which is itself a collection of files) with "hexedit" in a way that it stops when a given string is found so that the surrounding text is visible and can be copied and if it is not the wanted text, continue till the next occurence of the string?
If so, could someone give me the exact command to do this? Again, I have no need to learn this software.
There may also be a more suitable program but I am completely ignorant of what could be used.
Using hexedit is one of those things you find are extremely simple when you try the only problem was it's too slow for that sort of work (inspecting a 5GB file one byte at a time), looking for a single string was still showing no result after 20 minutes of disk activity so I had to abandon the idea. I also found the file with no backup was not in the directory deleted after all which contributed to my decision.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.