在从二进制转换为ASCII十六进制时使用单个命令 [英] To use a single command in converting from binary to ascii hex

查看:127
本文介绍了在从二进制转换为ASCII十六进制时使用单个命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将二进制数据转换为十六进制,并从连续流的头部开始查看此十六进制数据. 我在此处

I am converting binary data into hex and viewing this hex data in head from a continuous stream. I run the following where the conversion is from here

echo "ibase=2;obase=10000;$(echo `sed '1q;d' /Users/masi/Dropbox/123/r3.raw`)" \ 
                                                                               \ 
| bc                                                                           \
                                                                               \  
| head

我明白了

(standard_in) 1: illegal character: H

数据类型错误.

如何通过单个命令有效地将二进制格式转换为二进制ascii?

How can you do the conversion form binary to binary ascii by a single command efficietly?

推荐答案

我根据Wintermute的评论运行以下代码

I run the following code based on Wintermute's comment

hexdump -e '/4 "%08x\n"' r3.raw 

例如,head r3.raw | hexdump -e '/4 "%08x\n"给出

ffffffff
555eea57
...

这篇关于在从二进制转换为ASCII十六进制时使用单个命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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