1

When I debug my ADF mobile application, I write command tail -f /var/log/system.log in terminal. And I get following output.

May 6 11:32:42 evosys-iMacs-iMac.local manager[507]: Obj-C [CH-1, State=created ableToSend=Yes]: Message arrived - VMMessage [
type: Plain[0x00]
prinorty: 2
channelID: -1
messageID: 3
length: 137
body: {41, 44, 46, 4D, 53, 47, 20, 31, 30, 30, 30, 30, 20, 20, 20, 35, 31,
       31, 20, 20, 20, 35, 31, 31, 20, 20, 20, 20, 20, 30, 20, 20, 20, 31,
       30, 31, 7B, 22, 72, 65, 73, 75, 6C, 74, 22, 3A, 5B, 5D, 2C, 22, 64,
       61, 74, 61, 43, 68, 61, 6E, 67, 65, 45, 76, 65, 6E, 74, 22, 3A, 7B,
       22, 76, 61, 72, 69, 61, 62, 6C, 65, 43, 68, 61, 6E, 67, 65, 73, 22,
       3A, 7B, 22, 76, 69, 65, 77, 53, 63, 6F, 70, 65, 22, 3A, 7B, 22, 2E,
       6E, 75, 6C, 6C, 22, 3A, 74, 72, 75, 65, 7D, 7D, 2C, 22, 70, 72, 6F,
       76, 69, 64, 65, 72, 43, 68, 61, 6E, 67, 65, 73, 22, 3A, 7B, 7D, 7D, 7D}
]

I have no idea how to convert body into string,

4

1 回答 1

1

我相信有更好的awk方法可以做到这一点,但为了快速回答

egrep -o '[[:xdigit:]]{2}[,}]' system.log | while read foo
do
  printf "\x${foo::2}"
done

产量

ADFMSG 10000 511 511 0 101{"结果":[],"dataChangeEvent":
{"variableChanges":{"viewScope":{".null":true}},"providerChanges":{}}}
于 2013-05-06T07:07:36.253 回答