linux shell 命令学习(5) xxd- make a hexdump or do the reverse.
时间:2014-05-07 19:59:25
收藏:0
阅读:490
对于标准输入或者给定的文件,显示其16进制的内容。也可以反过来进行转换。
|
1
2
3 |
xxd -h[elp]xxd [options] [infile [outfile]]xxd -r[evert] [options] [infile [outfile]] |
如果没有指定输入文件, 则采用标准输入。
-b: 以2进制格式进行输出
|
1
2
3
4 |
[work@cq02.com src]$ xxd -b train.ini0000000: 01011011
01110100 01110010 01100001 01101001 01101110 [train0000006: 01011101
00001101 00001010 01101110 01100111 01110010 ]..ngr000000c: 01100001
01101101 01100110 01101001 01101100 01100101 amfile |
-c: 每行输出多少个字节
|
1
2
3
4 |
[work@cq02-.com src]$ xxd -c4 train.ini0000000: 5b74
7261 [tra0000004: 696e
5d0d in]..... |
-g: 几个字节组成一组
|
1
2
3
4 |
[work@cq02.com src]$ xxd -g4 train.ini0000000: 5b747261
696e5d0d 0a6e6772 616d6669 [train]..ngramfi0000010: 6c653d22
6e675f32 772e7478 74220d0a le="ng_2w.txt"..0000020: 69746572
636f756e 743d3430 30300d0a itercount=4000.. |
-i:将文件内容输出成 c的一个数组格式
|
1
2
3
4
5
6
7
8 |
[work@cq02-.com src]$ xxd -i train.iniunsigned char train_ini[] =
{ 0x5b, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x5d, 0x0d, 0x0a, 0x6e, 0x67, 0x72, 0x61, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x3d, 0x22, 0x6e, 0x67, 0x5f, 0x32, 。。。。 0x69, 0x73, 0x74, 0x22};unsigned int
train_ini_len =
148; |
-l : 输出几个字节后结束
|
1
2 |
[work@cq02.com src]$ xxd -l12 train.ini0000000: 5b74
7261 696e 5d0d 0a6e 6772
[train]..ngr |
-p:以一个整块输出所有的hex, 不使用空格进行分割
|
1
2
3
4
5
6 |
[work@cq02.com src]$ xxd -p train.ini5b747261696e5d0d0a6e6772616d66696c653d226e675f32772e747874220d0a69746572636f756e743d343030300d0a73766d6761703d302e303030310d0a74656d706469723d2274656d70220d0a7664636c6973743d227664632e7478742220204f520d0a77686974656c6973743d2277686974652e6c697374220d0a626c61636b6c6973743d22626c61636b2e6c69737422 |
-r: 反转操作,将16进制专程2进制
-s [+][-]seek : 从第几个字符开始
|
1
2
3
4 |
[work@cq02.com src]$ xxd -s5 train.ini 0000005: 6e5d
0d0a 6e67 7261 6d66 696c 653d 226e n]..ngramfile="n0000015: 675f
3277 2e74 7874 220d 0a69 7465 7263 g_2w.txt"..iterc0000025: 6f75
6e74 3d34 3030 300d 0a73 766d 6761 ount=4000..svmga |
-u : 输出采用大写
linux shell 命令学习(5) xxd- make a hexdump or do the reverse.,布布扣,bubuko.com
评论(0)