単純なバイナリファイルをテキストファイルに変換します。
od –t x1 Check.tar | cut –c8- > Check.txt
その内容は次のようになります。
64 65 76 2f 6e 75 6c 6c 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[...]
反対のアプローチは何ですか? Check.txtを元のファイルにCheck.tarに変換するのですか?
ベストアンサー1
od -An -vtx1 Check.tar > Check.txt
同じバイトシーケンスが必要-v
または圧縮されます。od
その逆:
LC_ALL=C tr -cd 0-9a-fA-F < Check.txt | xxd -r -p > Check.tar
または:
perl -ape '$_=pack "(H2)*", @F' Check.txt > Check.tar
ASCIIテキストのみをサポートするチャンネルを介してファイルを転送したい場合は、次の特殊なツールを使用できますuuencode
。
tar cf - myfiles.* | xz | uuencode myfiles.tar.xz | that-channel
そして、反対側から次のファイルを復元します。
uudecode < file.uu
再生成されますmyfiles.tar.xz
。
または:
uudecode -o - < file.uu | xz -d | tar xf -
ファイルの抽出中。