如何只打印十六进制转储中的十六进制值而没有行号或ASCII表? [英] How to print only the hex values from hexdump without the line numbers or the ASCII table?

查看:87
本文介绍了如何只打印十六进制转储中的十六进制值而没有行号或ASCII表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

跟随在UNIX shell脚本中将十进制转换为十六进制

我试图仅打印 hexdump 中的 hex值,即不打印行号和ASCII表.

I am trying to print only the hex values from hexdump, i.e. don't print the lines numbers and the ASCII table.

但是以下命令行不会显示任何内容:

But the following command line doesn't print anything:

hexdump -n 50 -Cs 10 file.bin |  awk '{for(i=NF-17; i>2; --i) print $i}'

推荐答案

您可以指定希望 hexdump 用于输出的确切格式,但这有点棘手.这是默认输出,减去文件偏移量:

You can specify the exact format that you want hexdump to use for output, but it's a bit tricky. Here's the default output, minus the file offsets:

hexdump -e '16/1 "%02x " "\n"' file.bin

(对我来说,这似乎会在末尾产生额外的尾随空间每一行,但出于某种原因却没有.)

(To me, it looks like this would produce an extra trailing space at the end of each line, but for some reason it doesn't.)

这篇关于如何只打印十六进制转储中的十六进制值而没有行号或ASCII表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆