Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12th September 2012, 06:50 AM
paufp Offline
Registered User
 
Join Date: Apr 2010
Age: 36
Posts: 6
linuxfirefox
Question HEX output reverse bits

Hello all.
I need to display file content in HEX format (test file contains of "test TEST test TEST ..." string):
Code:
[user@localhost ~]# od --format=x1 --width=16 test.txt
0000000 74 65 73 74 20 54 45 53 54 20 74 65 73 74 20 54
...
but the problem is that I need to reverse bits in each byte before displaying it, so
0x74 should be 0x2E
0x65 should be 0xA6
and so on.

Is there any way to do it using CLI commands?

Thank you in advance for answering me.
Reply With Quote
  #2  
Old 12th September 2012, 09:52 AM
stevea's Avatar
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300
linuxfirefox
Re: HEX output reverse bits

You want a bit-wise reversal on a byte-wide unit ?

No - I don't think there is any CLI utility to do that readily. I'm sure there are hacky ways to remap bytes to accomplish his but ...

My first question would be WHY ? There is a good reason why no one does this at CLI - it's a rare requirement. People re-order bytes within 16, 32, 64 bit words all the time - but bitwise toggle is very rare.

What is the application ?


Not CLI but fwiw,
http://stackoverflow.com/questions/7...o-lsb-msb-in-c
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe

Last edited by stevea; 12th September 2012 at 09:54 AM.
Reply With Quote
  #3  
Old 12th September 2012, 10:45 AM
Jean Pierre Offline
Registered User
 
Join Date: Feb 2011
Posts: 73
linuxfedoraseamonkey
Re: HEX output reverse bits

try :
Code:
echo "test TEST test TEST ..." | tr "\0\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\40\41\42\43\44\45\46\47\50\51\52\53\54\55\56\57\60\61\62\63\64\65\66\67\70\71\72\73\74\75\76\77\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" "\0\200\100\300\40\240\140\340\20\220\120\320\60\260\160\360\10\210\110\310\50\250\150\350\30\230\130\330\70\270\170\370\4\204\104\304\44\244\144\344\24\224\124\324\64\264\164\364\14\214\114\314\54\254\154\354\34\234\134\334\74\274\174\374\2\202\102\302\42\242\142\342\22\222\122\322\62\262\162\362\12\212\112\312\52\252\152\352\32\232\132\332\72\272\172\372\6\206\106\306\46\246\146\346\26\226\126\326\66\266\166\366\16\216\116\316\56\256\156\356\36\236\136\336\76\276\176\376\1\201\101\301\41\241\141\341\21\221\121\321\61\261\161\361\11\211\111\311\51\251\151\351\31\231\131\331\71\271\171\371\5\205\105\305\45\245\145\345\25\225\125\325\65\265\165\365\15\215\115\315\55\255\155\355\35\235\135\335\75\275\175\375\3\203\103\303\43\243\143\343\23\223\123\323\63\263\163\363\13\213\113\313\53\253\153\353\33\233\133\333\73\273\173\373\7\207\107\307\47\247\147\347\27\227\127\327\67\267\167\367\17\217\117\317\57\257\157\357\37\237\137\337\77\277\177\377" | od --format=x1 --width=16
Reply With Quote
  #4  
Old 12th September 2012, 11:55 AM
paufp Offline
Registered User
 
Join Date: Apr 2010
Age: 36
Posts: 6
linuxfirefox
Re: HEX output reverse bits

Quote:
Originally Posted by Jean Pierre View Post
try :
Code:
echo "test TEST test TEST ..." | tr "\0\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\40\41\42\43\44\45\46\47\50\51\52\53\54\55\56\57\60\61\62\63\64\65\66\67\70\71\72\73\74\75\76\77\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" "\0\200\100\300\40\240\140\340\20\220\120\320\60\260\160\360\10\210\110\310\50\250\150\350\30\230\130\330\70\270\170\370\4\204\104\304\44\244\144\344\24\224\124\324\64\264\164\364\14\214\114\314\54\254\154\354\34\234\134\334\74\274\174\374\2\202\102\302\42\242\142\342\22\222\122\322\62\262\162\362\12\212\112\312\52\252\152\352\32\232\132\332\72\272\172\372\6\206\106\306\46\246\146\346\26\226\126\326\66\266\166\366\16\216\116\316\56\256\156\356\36\236\136\336\76\276\176\376\1\201\101\301\41\241\141\341\21\221\121\321\61\261\161\361\11\211\111\311\51\251\151\351\31\231\131\331\71\271\171\371\5\205\105\305\45\245\145\345\25\225\125\325\65\265\165\365\15\215\115\315\55\255\155\355\35\235\135\335\75\275\175\375\3\203\103\303\43\243\143\343\23\223\123\323\63\263\163\363\13\213\113\313\53\253\153\353\33\233\133\333\73\273\173\373\7\207\107\307\47\247\147\347\27\227\127\327\67\267\167\367\17\217\117\317\57\257\157\357\37\237\137\337\77\277\177\377" | od --format=x1 --width=16
Great! Thank you very much!
Reply With Quote
  #5  
Old 12th September 2012, 12:48 PM
flyingfsck Online
Registered User
 
Join Date: Aug 2010
Location: Al Ain, UAE
Posts: 1,052
linuxfirefox
Re: HEX output reverse bits

Just turn the screen upside down.
Reply With Quote
  #6  
Old 12th September 2012, 01:15 PM
paufp Offline
Registered User
 
Join Date: Apr 2010
Age: 36
Posts: 6
windows_7chrome
Smile Re: HEX output reverse bits

Quote:
Originally Posted by flyingfsck View Post
Just turn the screen upside down.
Yeah! I like the answer
Reply With Quote
Reply

Tags
bits, hex, output, reverse

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Installation of CUPS in 64 and 32 bits for a 32 bits printer driver? fiabledotbiz Using Fedora 1 14th October 2012 03:52 PM
32 bits livna packages on 64 bits fedora 8 RGB Using Fedora 3 25th June 2008 01:34 PM
Command to reverse console output by line? savage Using Fedora 3 23rd June 2008 06:09 PM
building programs on FC5 (64 bits) for FC4 (64 bits) mtk Programming & Packaging 2 16th May 2006 06:36 AM
Main difference between 32 bits and 64 bits lvthn Using Fedora 4 11th June 2005 06:39 PM


Current GMT-time: 16:12 (Monday, 20-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat