내가 보고 싶은 것:
$ printf "\U1F600\n"|hexdump -v -e '1/1 " %03o"'|tr ' ' '\\'
\360\237\230\200\012
내가 시도한 것:
$ printf "\U1F600\n"|hexdump -v -e '1/1 "\\%03o"'
hexdump: bad conversion character %�
$ printf "\U1F600\n"|hexdump -v -e '1/1 "\%03o"'
hexdump: bad conversion character %%
$ printf "\U1F600\n"|hexdump -v -e '1/1 "\\\%03o"'
hexdump: bad conversion character %\
$ printf "\U1F600\n"|hexdump -v -e '1/1 "\\\\%03o"'
\\\\360\\\\237\\\\230\\\\200\\\\12
답변1
hexdump
매뉴얼 페이지의 예를 바탕으로 :
# hex with preceding 'x' % echo hello | hexdump -v -e '"x" 1/1 "%02X" " "' ; echo x68 x65 x6C x6C x6F x0A
사용하시면 될 것 같습니다-e '"\\" 1/1 "%03o" '
전임자.
$ echo hello | hexdump -v -e '"\\" 1/1 "%03o" ' ; echo
\150\145\154\154\157\012