2014년 9월 18일 목요일

Bash solution for ShortCutFoo binary email puzzle

In a previous post last week, I introduced a Python solution for converting an email in binary to ASCII. In my day job, I'm a Linux Engineer, so I should be able to write a Bash script to do the same thing. Here is what I came up with:


There are two different versions that parse a LF (linefeed) delimited textfile containing all the 8-character binary strings from the original email. To convert from space-delimited to LF-delimited text, I simply pasted the text into an Emacs buffer and ran M-x replace-text and replaced [SPACE] with [RETURN] (which has to be entered in escaped form as Ctrl-q Ctrl-j in Emacs). bintext.txt is available here.

The first version is a bit more roundabout than the second because it converts from binary to decimal to hexadecimal to ASCII (4 steps).

The second version converts from binary to octal to ASCII (3 steps).

댓글 없음:

댓글 쓰기