UnixからLinuxに変換し、ddにconv = asciibオプションを使用します。

UnixからLinuxに変換し、ddにconv = asciibオプションを使用します。

Unixサーバーの一部のSASプログラムをLinuxプログラムに変換しています。

SASプログラムに組み込まれているコマンドは次のとおりです。

dd if=myfile.txt ibs=1 cbs=10 count=10 skip=0 conv=asciib

Unixでは、次の出力が提供されます。

31.08.2021
10+0 records in
0+1 records out

このコマンドはLinuxでエラーを発生させます。

dd: invalid conversion: ‘asciib’
Try 'dd --help' for more information.

私は前に試しました

dd if=myfile.txt ibs=1 cbs=10 count=10 skip=0 conv=ascii

しかし、私が得た結果はUnixとは少し異なります。

31.08.202110+0 records in
0+1 records out
10 bytes (10 B) copied, 4.8966e-05 s, 204 kB/s

LinuxでUnixとまったく同じ結果を得ることはできますか? 「完全に同じ出力」のために、日付以降に新しい行を作成し、行を持たないようにします。

10 bytes (10 B) copied, 4.8966e-05 s, 204 kB/s

後でSASプログラムで使用されるため、正確な出力が必要です。

必要に応じて:
Unixで:
コマンド:

dd if=myfile.txt ibs=1 cbs=10 count=10 skip=0 conv=asciib 2>/dev/null | od -c

結果:

Ambiguous output redirect

Linux:
コマンド:

dd if=myfile.txt ibs=1 cbs=10 count=10 skip=0 conv=ascii 2>/dev/null | od -c

結果:

0000000   3   1   .   0   8   .   2   0   2   1
0000012`enter code here`

ベストアンサー1

おすすめ記事