Tim*_*ien 5 ascii hexdump decimal
centos 6.5-运行hexdump
$ hexdump -C filecsv
00000000 44 4f 53 2c 20 50 61 74 69 65 6e 74 2c 20 41 63 |DOS, Patient, Ac|
00000010 63 74 20 23 2c 20 4d 52 20 23 2c 20 54 69 6d 65 |ct #, MR #, Time|
Run Code Online (Sandbox Code Playgroud)
喜欢这种格式,但希望将十六进制转换为十进制我已经花了很多时间但是找不到它?
hexdump支持通过命令行选项指定格式字符串-e,而且看起来相当灵活。
例子:
$ hexdump -C b.c
00000000 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e |#include <stdio.|
00000010 68 3e 0a 69 6e 74 20 6d 61 69 6e 28 29 7b 0a 20 |h>.int main(){. |
00000020 20 70 72 69 6e 74 66 28 22 68 65 6c 6c 6f 20 77 | printf("hello w|
00000030 6f 72 6c 64 5c 6e 22 29 3b 0a 20 20 72 65 74 75 |orld\n");. retu|
00000040 72 6e 20 30 3b 0a 7d 0a |rn 0;.}.|
00000048
$ hexdump -e'"%07.8_ax " 8/1 "%02x " " " 8/1 "%02x " " |"' -e'16/1 "%_p" "|\n"' b.c
00000000 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e |#include <stdio.|
00000010 68 3e 0a 69 6e 74 20 6d 61 69 6e 28 29 7b 0a 20 |h>.int main(){. |
00000020 20 70 72 69 6e 74 66 28 22 68 65 6c 6c 6f 20 77 | printf("hello w|
00000030 6f 72 6c 64 5c 6e 22 29 3b 0a 20 20 72 65 74 75 |orld\n");. retu|
00000040 72 6e 20 30 3b 0a 7d 0a |rn 0;.}.|
$ hexdump -e'"%07.8_ad " 8/1 "%03d " " " 8/1 "%03d " " |"' -e'16/1 "%_p" "|\n"' b.c
00000000 035 105 110 099 108 117 100 101 032 060 115 116 100 105 111 046 |#include <stdio.|
00000016 104 062 010 105 110 116 032 109 097 105 110 040 041 123 010 032 |h>.int main(){. |
00000032 032 112 114 105 110 116 102 040 034 104 101 108 108 111 032 119 | printf("hello w|
00000048 111 114 108 100 092 110 034 041 059 010 032 032 114 101 116 117 |orld\n");. retu|
00000064 114 110 032 048 059 010 125 010 |rn 0;.}.|
Run Code Online (Sandbox Code Playgroud)
不确定如何重现 . 生成的最后一行-C。
请参阅此处了解更多详细信息。