Bashの逆方向16進数

Bashの逆方向16進数

16進数を変更する簡単なコマンドはありますか?

たとえば、16進数を指定すると、次のようになります。

030201

出力は次のようになります。

010203

このrevコマンドを使用すると、次のような結果が得られます。

102030

修正する

$ bash --version | head -n1
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
$ xxd -version
xxd V1.10 27oct98 by Juergen Weigert
$ rev --version
rev from util-linux 2.20.1

ベストアンサー1

fold++で:tactr

$ echo 030201|fold -w2|tac|tr -d "\n"
010203
  • fold- 2バイトごとに分割
  • tac- リバース猫
  • tr- 改行文字を削除

おすすめ記事