Is there a simple utility like printf that'll give me a "binary representation", i.e. a string like "01010010", from an input string? It would need to support multi-byte encodings.
-
i was going to say od, but it doesnt output binary. googling about using od for binary output, found this, might be helpful: blog.2of1.org/2011/03/24/binary-output-using-od-cut-and-perlmarcelog– marcelog2011-07-30 00:35:36 +00:00Commented Jul 30, 2011 at 0:35
Add a comment
|
2 Answers
You can also do this (and many other things) using figlet with the binary font.
$ echo foo | figlet -f binary
01100110 01101111 01101111
-
@bahamat: I love the style of
figletsbig font output (+1 for that :) , but I there is not 'binary' format for version 2.2.2..Peter.O– Peter.O2011-07-30 19:17:37 +00:00Commented Jul 30, 2011 at 19:17 -
I'm using 2.2.4, and I have the binary font. You have to download it from figlet.org (I already posted the link).bahamat– bahamat2011-07-30 19:52:46 +00:00Commented Jul 30, 2011 at 19:52
-
I downloaded
binary.flf, and it works to just add a new .flf file to /usr/share/figlet... Now that I've actually tried it, I'll mention that unless you manually modifybinary.flf, it does not convert spaces to binary...Peter.O– Peter.O2011-07-31 01:57:53 +00:00Commented Jul 31, 2011 at 1:57