Conversion hex string into ascii in bash command line

前端 未结 7 1477
孤独总比滥情好
孤独总比滥情好 2020-12-12 23:43

I have a lot of this kind of string and I want to find a command to convert it in ascii, I tried with echo -e and od, but it did not work.

相关标签:
7条回答
  • 2020-12-13 00:30

    You can use something like this.

    $ cat test_file.txt
    54 68 69 73 20 69 73 20 74 65 78 74 20 64 61 74 61 2e 0a 4f 6e 65 20 6d 6f 72 65 20 6c 69 6e 65 20 6f 66 20 74 65 73 74 20 64 61 74 61 2e
    
    $ for c in `cat test_file.txt`; do printf "\x$c"; done;
    This is text data.
    One more line of test data.
    
    0 讨论(0)
提交回复
热议问题