Domanda

I was wondering how I could retrieve bytes from a files given an offset and a length.

I came to the following line : hexdump -n 4 -s 0x11C myFile

I get the following : Not good enough, I don't need the offset.

000011c 00 00 8c d0

Second try :

hexdump -n 4 -s 0x11C -e '"%x\n"' myFile

I get the following : better but wrong endianness.

d08c0000

So how can I do it ? I know I could parse it with sed, but isn't there a «cleaner» solution that that ?

È stato utile?

Soluzione

hexdump -n 4 -s 0x11C -e '4/1 "%x " "\n"' myFile

(My version of hexdump does not produce one-byte hex output as in your first example. Did you use some other command option?)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top