viewing binaries as 1s and 0s
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > viewing binaries as 1s and 0s




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    viewing binaries as 1s and 0s  
Chakravarthi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-19-05 11:06 PM

hi,

Is there a command that when run on a binary
file shows 0s and 1s instead of gibberish ?

cheers,
chax.





[ Post a follow-up to this message ]



    Re: viewing binaries as 1s and 0s  
Rich Teer


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-19-05 11: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





[ Post a follow-up to this message ]



    Re: viewing binaries as 1s and 0s  
John Smith


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-19-05 11: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







[ Post a follow-up to this message ]



    Re: viewing binaries as 1s and 0s  
John W. Krahn


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-20-05 12:48 PM

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





[ Post a follow-up to this message ]



    Re: viewing binaries as 1s and 0s  
Chuck Dillon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-20-05 10: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/1
11/g"
000111011101101000 000110000101110100 000010000001110100
000110100001100101 000010000001101000 000110010101100011 000110101100001010

-- ced


--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.





[ Post a follow-up to this message ]



    Re: viewing binaries as 1s and 0s  
Pan Jiaming


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-20-05 10: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 00011010110000101
0
>
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






[ Post a follow-up to this message ]



    Re: viewing binaries as 1s and 0s  
Chakravarthi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-20-05 10:52 PM

"John Smith" <john.smith@x-formation.com> wrote in message news:<42656b3e$0$643$edfadb0f@dre
ad16.news.tele.dk>... 
> If you don't find any, why don't you write your own tool? It's probably no
t
> 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.





[ Post a follow-up to this message ]



    Re: viewing binaries as 1s and 0s  
phil_gg04@treefic.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-20-05 10:52 PM

In case anyone is having trouble finding it, xxd comes with vim.

--Phil.






[ Post a follow-up to this message ]



    Re: viewing binaries as 1s and 0s  
David Schwartz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-20-05 10: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







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:40 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register