| Author |
viewing binaries as 1s and 0s
|
|
| Chakravarthi 2005-04-19, 6:06 pm |
| hi,
Is there a command that when run on a binary
file shows 0s and 1s instead of gibberish ?
cheers,
chax.
| |
| Rich Teer 2005-04-19, 6:06 pm |
| On Tue, 19 Apr 2005, Chakravarthi wrote:
> Is there a command that when run on a binary
> file shows 0s and 1s instead of gibberish ?
The od command is probably what you're after, although it doesn't
support binqary output (but hex and octal are supported).
HTH,
-
Rich Teer, SCNA, SCSA, OpenSolaris CAB member
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
| |
| John Smith 2005-04-19, 6:06 pm |
| > Is there a command that when run on a binary
> file shows 0s and 1s instead of gibberish ?
>
If you don't find any, why don't you write your own tool? It's probably not
more then like 10-15 lines of code in C.
-- John
| |
| John W. Krahn 2005-04-20, 7:48 am |
| Chakravarthi wrote:
>
> Is there a command that when run on a binary
> file shows 0s and 1s instead of gibberish ?
perl -lne'BEGIN{$/=\8}print unpack"B*",$_' yourfile
John
--
use Perl;
program
fulfillment
| |
| Chuck Dillon 2005-04-20, 5:52 pm |
| Chakravarthi wrote:
> hi,
>
> Is there a command that when run on a binary
> file shows 0s and 1s instead of gibberish ?
>
> cheers,
> chax.
cdillon@*****(190)> echo what the heck
what the heck
cdillon@*****(191)> echo what the heck | od -o
0000000 073550 060564 020164 064145 020150 062543 065412
0000016
cdillon@*****(192)> echo what the heck | od -o | cut -sd\ -f2-
073550 060564 020164 064145 020150 062543 065412
cdillon@*****(193)> echo what the heck | od -o | cut -sd\ -f2- | sed \
"s/0/000/g;s/1/001/g;s/2/010/g;s/3/011/g;s/4/100/g;s/5/101/g;s/6/110/g;s/7/111/g"
000111011101101000 000110000101110100 000010000001110100
000110100001100101 000010000001101000 000110010101100011 000110101100001010
-- ced
--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
| |
| Pan Jiaming 2005-04-20, 5:52 pm |
| ÓÚ Wed, 20 Apr 2005 09:29:22 -0500£¬Chuck Dillonдµ½£º
> Chakravarthi wrote:
>
>
> cdillon@*****(190)> echo what the heck
> what the heck
> cdillon@*****(191)> echo what the heck | od -o
> 0000000 073550 060564 020164 064145 020150 062543 065412
> 0000016
> cdillon@*****(192)> echo what the heck | od -o | cut -sd\ -f2-
> 073550 060564 020164 064145 020150 062543 065412
> cdillon@*****(193)> echo what the heck | od -o | cut -sd\ -f2- | sed \
> "s/0/000/g;s/1/001/g;s/2/010/g;s/3/011/g;s/4/100/g;s/5/101/g;s/6/110/g;s/7/111/g"
> 000111011101101000 000110000101110100 000010000001110100
> 000110100001100101 000010000001101000 000110010101100011 000110101100001010
>
James:/usr/include# echo what the heck | xxd -b
0000000: 01110111 01101000 01100001 01110100 00100000 01110100 what t
0000006: 01101000 01100101 00100000 01101000 01100101 01100011 he hec
000000c: 01101011 00001010
> -- ced
| |
| Chakravarthi 2005-04-20, 5:52 pm |
| "John Smith" <john.smith@x-formation.com> wrote in message news:<42656b3e$0$643$edfadb0f@dread16.news.tele.dk>...
> If you don't find any, why don't you write your own tool? It's probably not
> more then like 10-15 lines of code in C.
>
> -- John
I already wrote a small script before I posted this
query. I also wrote a program (I require it)
.. which takes 0s and 1s sequence (char or int)
and pack it into binary file..
I wanted to know if a command or some function
already exits to do the same .. especially the
second one..
thanx
chax.
| |
| phil_gg04@treefic.com 2005-04-20, 5:52 pm |
| In case anyone is having trouble finding it, xxd comes with vim.
--Phil.
| |
| David Schwartz 2005-04-20, 5:52 pm |
|
<phil_gg04@treefic.com> wrote in message
news:1114017722.375856.20280@l41g2000cwc.googlegroups.com...
> In case anyone is having trouble finding it, xxd comes with vim.
>
> --Phil.
>
"xxd -i" is one of the most useful tools in the world. I seem to
rediscover it every few years. And 'xxd -b' can do what the op wants.
DS
|
|
|
|