提取“明文” HEX文件使用Perl的头文件 [英] Extracting "plaintext" header from HEX file using Perl

查看:263
本文介绍了提取“明文” HEX文件使用Perl的头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



使用HEXedit,这就是我所看到的文件,它显示了明文头文件,我想提取并转换为明文文件。 ,它在一个文件中:

  3a40  -  31 65 33 38 00 00 00 00 00 00 00 00 00 00 00 00  - 1e38 ............ 
3a50 - 00 00 00 00 00 00 00 00 00 00 0a 00 74 00 65 00 - ............ te
3a60 - 78 00 74 00 2f 00 61 00 73 00 63 00 69 00 69 00 - x.t./.a.s.c.i.i。
3a70 - 00 00 18 00 61 00 66 00 66 00 79 00 6d 00 65 00 - .... affyme
3a80 - 74 00 72 00 69 00 78 00 2d 00 61 00 72 00 72 00 - trix-.arr
3a90 - 61 00 79 00 2d 00 62 00 61 00 72 00 63 00 6f 00 - ay-.barco
3aa0 - 64 00 65 00 00 00 64 00 40 00 35 00 32 00 30 00 - d.e ... d。@。5.2.0。
3ab0 - 38 00 32 00 36 00 30 00 30 00 39 00 31 00 30 00 - 8.2.6.0.0.9.1.0。
3ac0 - 37 00 30 00 36 00 31 00 31 00 31 00 38 00 31 00 - 7.0.6.1.1.1.8.1。
3ad0 - 31 00 34 00 31 00 32 00 31 00 33 00 34 00 35 00 - 1.4.1.2.1.3.4.5。
3ae0 - 35 00 30 00 39 00 38 00 39 00 00 00 00 00 00 00 - 5.0.9.8.9 .......
3af0 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - ................
3b00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a 00 - ... .............

这是我输出的结果喜欢获得:

$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $'


解决方案

使用 iconv 命令。像这样的东西应该可以工作:

  tail -c +6 input.txt | iconv -f UTF16 -t ASCII> output.txt 

然后分割空字节。 p>

Have a file that appears to have plaintext headers in them that I would like to extract and convert to plaintext.

Using HEXedit, this is what I'm seeing, which is in a file:

3a40 - 31 65 33 38 00 00 00 00 00 00 00 00 00 00 00 00 - 1e38............
3a50 - 00 00 00 00 00 00 00 00 00 00 0a 00 74 00 65 00 - ............t.e.
3a60 - 78 00 74 00 2f 00 61 00 73 00 63 00 69 00 69 00 - x.t./.a.s.c.i.i.
3a70 - 00 00 18 00 61 00 66 00 66 00 79 00 6d 00 65 00 - ....a.f.f.y.m.e
3a80 - 74 00 72 00 69 00 78 00 2d 00 61 00 72 00 72 00 - t.r.i.x.-.a.r.r
3a90 - 61 00 79 00 2d 00 62 00 61 00 72 00 63 00 6f 00 - a.y.-.b.a.r.c.o.
3aa0 - 64 00 65 00 00 00 64 00 40 00 35 00 32 00 30 00 - d.e...d.@.5.2.0.
3ab0 - 38 00 32 00 36 00 30 00 30 00 39 00 31 00 30 00 - 8.2.6.0.0.9.1.0.
3ac0 - 37 00 30 00 36 00 31 00 31 00 31 00 38 00 31 00 - 7.0.6.1.1.1.8.1.
3ad0 - 31 00 34 00 31 00 32 00 31 00 33 00 34 00 35 00 - 1.4.1.2.1.3.4.5.
3ae0 - 35 00 30 00 39 00 38 00 39 00 00 00 00 00 00 00 - 5.0.9.8.9.......
3af0 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - ................
3b00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a 00 - ................

and this is the output I'd like to get:

text/ascii  affymetrix-array-barcode d@52082600910706111811412134550989

解决方案

Try with the iconv command. Something like this should work:

tail -c +6 input.txt | iconv -f UTF16 -t ASCII >output.txt

Then split on the null bytes.

这篇关于提取“明文” HEX文件使用Perl的头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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