在LINUX 系统下如何将二进制转换成ASCII码?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在LINUX 系统下如何将二进制转换成ASCII码?相关的知识,希望对你有一定的参考价值。

在LINUX 系统下如何将二进制转换成ASCII码?
有没有相关转换程序,或SH 转换命令

在线转换器http://www.ab126.com/goju/1711.html

hexdump命令,可以将文件(不光是二进制文件)按各种格式显示,当然包括ASCII。

你可以用这个命令再配合‘>’输入到文件里,就起到转换的效果了。
参考技术A 你干嘛用?

你是想反编译,还是想转换成 7bit 的编码?追问

我描述下背景:我在IBS OS390 上有个VSAM 文件,我需要将它DOWNLOAD 到 一台LINUX系统上,并导入到LINUX下的DB2 Table里面,因我下载采用BIN码下载到LINUX系统里面,(之前我尝试过用ASC下载,视乎不太稳定,之前出现过可以成功导入DB2,但是有时,又不可以导入),故现在,我在导入DB2前,先转成ASCII 格式。

追答

那就 base64 编码呗。
Linux 下面有这个命令,base64 这个命令就是。这个编码方法,好像很多数据库和开发语言都有支持。调用很方便。

Usage: base64 [OPTION]... [FILE]
Base64 encode or decode FILE, or standard input, to standard output.

-d, --decode decode data
-i, --ignore-garbage when decoding, ignore non-alphabet characters
-w, --wrap=COLS wrap encoded lines after COLS character (default 76).
Use 0 to disable line wrapping

--help display this help and exit
--version output version information and exit

With no FILE, or when FILE is -, read standard input.

The data are encoded as described for the base64 alphabet in RFC 3548.
When decoding, the input may contain newlines in addition to the bytes of
the formal base64 alphabet. Use --ignore-garbage to attempt to recover
from any other non-alphabet bytes in the encoded stream.

本回答被提问者采纳
参考技术B od -t c 以ascii码查看。详细的可以查下od命令的用法。

以上是关于在LINUX 系统下如何将二进制转换成ASCII码?的主要内容,如果未能解决你的问题,请参考以下文章

BCD码转换成ASCII值

十进制100怎样转换成ascii码?

十进制ASCII码的转换!

十进制转换了ASCII怎么转换

请用简单易懂的方法说明 ASCII码如何运算?我附的图第四题答案我看不懂

获取码值(各种类型字符(中英)的ASCII)和进制转换系统(包括正负数小数)