LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   reversing a hexadecimal string in shell (https://www.linuxquestions.org/questions/linux-newbie-8/reversing-a-hexadecimal-string-in-shell-935609/)

mayurirao 03-21-2012 01:20 AM

reversing a hexadecimal string in shell
 
Hello
I help with doing the following..
I have a table in a text file like this

blah blah 6F1A010105 12346F
blah blah 4A1F010206 32141A
...
...

I need to do the following.

1) In the third column the bytes are reversed eg) Row1 Col3 should read as 0501011A6F
2) Convert the order corrected third column and the fourth column to decimal

How would I do this.
The output should be written into a file with the 3 and 4th column replaced by the decimal values

- Thanks

grail 03-21-2012 02:19 AM

Pretty much pick a language, perl, python, ruby, or even awk can probably do what you need. What do you have strengths in and what have you tried?


All times are GMT -5. The time now is 03:00 PM.