Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何从给定偏移量和长度的文件中检索字节。
我来到以下行:hexdump -n 4 -s 0x11C myFile
hexdump -n 4 -s 0x11C myFile
我得到以下信息:不够好,我不需要偏移量。
000011c 00 00 8c d0
第二次尝试:
hexdump -n 4 -s 0x11C -e '"%x\n"' myFile
我得到以下信息:更好但错误的字节序。
d08c0000
那么我该怎么做呢?我知道我可以用 sed 解析它,但是没有一个“更清洁”的解决方案吗?
hexdump -n 4 -s 0x11C -e '4/1 "%x " "\n"' myFile
(我的 hexdump 版本不会像您的第一个示例那样产生单字节十六进制输出。您是否使用了其他命令选项?)