Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    Can you show exactly what you want the end result to be? I'm having trouble following your question. Most likely the most convenient tool for extracting a chunk of a binary file will be dd, but without understanding exactly what chunk you want to extract I'm limiting to making this a comment rather than an answer. Commented Jun 26, 2015 at 16:55
  • @godlygeek I added the wanted output in two files. Commented Jun 26, 2015 at 17:00
  • Unless I'm missing something, that seems to be splitting in the middle of a byte - fafafafad0 starts at character 195 of the hex dump, meaning it's byte 98 of the binary file, but fafafafa6a starts at character 968 of the hex dump, 773 characters of hex later, which means it's 386.5 bytes later, which means it's across a byte boundary. Your "file 001.txt" is 773 characters long, which isn't normally a valid length for a hex dump - hex dumps must have an even number of characters, since each byte of the input is 2 characters. Commented Jun 26, 2015 at 17:13
  • @godlygeek Sorry for my mistake. I added correct data now as a link. The byte distance is now 48300 (60*805). There are two headers in the data. I tried to simplify the original data unsuccessfully. Commented Jun 26, 2015 at 17:37
  • 1
    You should really drop that -P ON grep - it's not doing you any favors there. In general, just dump the file with od or strings or whatever and grep the results - you don't need to save a copy of the whole encoded file, though - you already have the other. And grepping stuff like that is already going to be tedious enough, and so maybe just keep that actual searches basic if you can. Commented Jun 27, 2015 at 18:59