十六进制转储中的迭代计数和字节计数是什么? [英] what is iteration count and byte count in hexdump?

查看:131
本文介绍了十六进制转储中的迭代计数和字节计数是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux中处理hexdump命令确实令人困惑. 基本上,我试图从/proc/device-tree获取输出. 我试图使用hexdump,但最终陷入混乱. 我的dts包含

It was really confusing to deal with hexdump command in linux. Basically I am trying to get the output from the /proc/device-tree. I tried to use the hexdump but ended up with confusion. My dts contains

vvn = <0 0 2 2 0 0>;

我在/proc/device-tree下有一个proc节点.

I got a proc node under /proc/device-tree.

我尝试了以下命令.

hexdump -v  -e '4/1 "%x" " "' vvn ; echo
0000 0000 0002 0002 0000 0000

hexdump -v  -e '1/4 "%x" " "' vvn ; echo
0 0 2000000 2000000 0 0 

hexdump -v  -e '4/1 "%x "' vvn ; echo
0 0 0 00 0 0 00 0 0 20 0 0 20 0 0 00 0 0 0

我得到了不同的输出,我想所有人都会产生相同的输出. 谁能解释一下十六进制转储的迭代计数和字节数及其用途,以及如何使用该格式吗?

I got different output, I thought all will produce the same output. Can anyone please explain me how to use the iterationcount and bytecount of the hexdump and what it's for and How to use the format too?

推荐答案

迭代次数控制格式重复的次数.

Iteration count controls how may times the format will be repeated.

字节数指示每次迭代将格式化多少个字节.

Byte count indicates how many byte will be format for each iteration.

格式字符串与printf相同.

'4/1 "%x" " "':进行4次迭代:每次都用%x"格式化1个字节,并在迭代完成后插入" ".

'4/1 "%x" " "': iteration for 4 times: in each time, format 1 byte with "%x", and when the iteration finished, insert " ".

'1/4 "%x" " "':迭代1次:每次用%x"格式化4字节,迭代完成后,插入" ".等于'1/4 "%x "'

'1/4 "%x" " "': iteration for 1 time: in each time, format 4 byte with "%x", and when the iteration finished, insert " ". This is equal to '1/4 "%x "'

'4/1 "%x "':迭代4次:每次用%x"格式化1个字节;迭代完成后, 占用最后一个空格 ,不插入任何内容.

'4/1 "%x "': iteration for 4 times: in each time, format 1 byte with "%x "; when iteration finished, eats the last space, insert nothing.

我确实知道hexdump为什么要吃掉最后一个空格:(.

I do know why hexdump eats the last space :(.

这篇关于十六进制转储中的迭代计数和字节计数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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