Sample Header Ad - 728x90

How to recreate wildcard lines from `hexdump` output?

0 votes
0 answers
193 views
I have a problem: I have some old hexdumps laying around as text files. I want to recreate the files they represent because I'm interested in what these files were. The problem is: When I created these hexdumps I didn't know of the -v flag, so in some of the hexdumps some repeating lines are replaced with a *. What I want is a way to programmatically recreate those lines using bash or python3. I also have a concept no how to do it but I didn't manage to create a working script to recreate those lines. My concept is: 1. Check the file for lines which are made up of only a *. (if there are none, jump to step 6) 2. Loop through the found lines: 3. Calculate the amount of lines that were replaced with that asterisk, by taking the offset numbers. 4. Copy the line above the asterisk the calculated amount of times and thereby replace the asterisk. 5. If there are asterisks left: repeat steps 3 and 4 for the next asterisk, otherwise do step 6: 6. Print out the completed hexdump. ##### Question: Can someone please help me to create a script that does the above? Or a script that gives the same end result but works better?
Asked by Lampe2020 (115 rep)
Jul 1, 2022, 01:02 PM
Last activity: Jul 1, 2022, 01:10 PM