如何將檔案中的8進位跟ASCII轉成16進位 - Linux

By Quanna
at 2017-11-10T11:36
at 2017-11-10T11:36
Table of Contents
如題,如果我有個LOG檔如下:
write(4, "\240", 1) = 1
read(4, "_", 1) = 1
write(4, "\n", 1) = 1
read(4, "\365", 1) = 1
write(4, "P", 1) = 1
read(4, "\257", 1) = 1
write(4, "\5", 1) = 1
read(4, "\372", 1) = 1
write(4, "\375", 1) = 1
read(4, "\375", 1) = 1
read(4, "e\200", 2) = 2
那我能夠用Shell Script去把裡面的8進位跟ASCII轉換成16進位嗎?
我有試著研究了sed跟awk....不過感覺好像沒辦法做到?(或是我功力太淺了)
另外順便再問一下,為何我用strace去抓出來的東西都是用8進位顯示呀?
然後128以下的就顯示成ASCII,這樣真的有夠難讀的耶,
好像也沒看到參數可以改成16進位,而且好像8進位在LINUX很常看到,
這是為何呀?
--
尋找理想中的房子~
--
write(4, "\240", 1) = 1
read(4, "_", 1) = 1
write(4, "\n", 1) = 1
read(4, "\365", 1) = 1
write(4, "P", 1) = 1
read(4, "\257", 1) = 1
write(4, "\5", 1) = 1
read(4, "\372", 1) = 1
write(4, "\375", 1) = 1
read(4, "\375", 1) = 1
read(4, "e\200", 2) = 2
那我能夠用Shell Script去把裡面的8進位跟ASCII轉換成16進位嗎?
我有試著研究了sed跟awk....不過感覺好像沒辦法做到?(或是我功力太淺了)
另外順便再問一下,為何我用strace去抓出來的東西都是用8進位顯示呀?
然後128以下的就顯示成ASCII,這樣真的有夠難讀的耶,
好像也沒看到參數可以改成16進位,而且好像8進位在LINUX很常看到,
這是為何呀?
--
尋找理想中的房子~
--
Tags:
Linux
All Comments

By Franklin
at 2017-11-11T05:49
at 2017-11-11T05:49

By Jack
at 2017-11-15T09:53
at 2017-11-15T09:53

By Noah
at 2017-11-16T01:02
at 2017-11-16T01:02

By Ophelia
at 2017-11-19T14:32
at 2017-11-19T14:32
Related Posts
有人試過liva電腦跑linux嗎?

By Cara
at 2017-11-10T09:59
at 2017-11-10T09:59
ISO檔 img檔的製作

By Zora
at 2017-11-07T17:13
at 2017-11-07T17:13
centos7上torque

By Anthony
at 2017-11-06T23:57
at 2017-11-06T23:57
docker 中使用 kdevelop

By Skylar DavisLinda
at 2017-11-06T23:28
at 2017-11-06T23:28
SUSE Manager 監控管理

By Damian
at 2017-11-05T11:30
at 2017-11-05T11:30