$ od -t x1 <inputfile
produces … 0a e2 8c a5 0a …
.
The 0a
are linefeeds, and e2 8c a5
are the UTF-8 representation of a Unicode character.
For this simple case, I can do it by hand:
[1110]0010 [10]001100 [10]100101 = 10 0011 0010 0101 = 2 3 2 5
What shell command line can convert e2 8c a5
or e28ca5
into 2325
?
(For completeness, converting the other way would be good to know too.)
Try this command line to get what you want, '2325',
See also the output from the first part of the command line
(there is no line feed, so the prompt comes directly after its output),
As you can see, I get that special character
⌥
in the gnome-terminal window.Using the Perl Encode module, you could
So
this step only required because you've unpacked it with
od
- if you start with the character itself or byte sequence you just need the decode-encode:or
Try the following:
For
inputfile
containing three bytes with valuese2 8c a5
it outputs2325
.