Sorry, the below is a correct sample. I was doing some tests with the first sample and I changed bad the hex digits when I pasted here.
I read you code in the link you shared me. I see the code converts from hex each byte to decimal value to get the ascii char. But in
my file, some byte sequences BCD coded and should be interpreted as literal decimal values. For example the values highlighted in red
are the numbers 874401013008290 and 3742050001. Others are hexadecimal bytes sequences.
So, regarding the hexdump line below, how can I modifiy the hexdump command to print decimal values without convert it to hex value?,
I mean, when those sequences must be treated as decimal values literally.
If there is way to put in a template the rules defined in description of the file in how must be treated the sequences of bytes, I'll be able
to parse the binary file.
This should give you the _hex_ byte at position "$subscript" as a 2 byte text string.
This should correspond with the "values" you see but auto-changed to ASCII.
Just use a loop and concatenate that which you need...
I've been trying your code. But I'm not sure what happens when using the hexdump line you shared me in last post.
I want to interpret sequence of bytes as decimals (literal decimals). I'm using to test the code below:
The decimal sequence I would like to extract from the Binary sample in my previous post (in red) is from byte 36 to 43. The desired
result is: 87 44 01 01 30 08 29 0f. Exactly how it looks in hexdump, but the code is giving me another output (13568114884115)
and I don't know why.
(How is it that I, a mere amateur, is showing a professional the way?)
Actually I'm not a proffesional in this area of programming or unix, in fact I'm a newbie in bash scripts. I only asking in the forum where experts could help.
Now my problem would be how to decode based on description, because sequences of bytes are interpreted sometimes as iso coded, sometimes as decimal values, sometimes as binary coded. I think here is where a template for parsing is needed but I don't know how to do it helping me with the hexdump command.
With hexdump, is possible convert an hex number like "A" into binary?
A=1010.
I really have no idea how to parse NIBBLES directly but this as a byte transfer should be a starter and splitting into two halve should be very easy...
Search the forums for more info on adding leading zeros, lower to upper case, etc...
It's all on here...
Research the bc command for more info:-
Test using this Macbook Pro...
Last edited by wisecracker; 05-22-2013 at 04:23 AM..
Hello *nix specialists,
Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Hi to everyone :), i have a challenge right now in python that for now needs a bit of help in one part of the c0de.
The task is create a new file with the name of the file defined by the ASCII content between the 3 byte and the 16 byte that is parsed from the binary file, the file is over 20 Mb i... (0 Replies)
Hello guys,
We had to move from a DC to another, and we are now facing an "issue" with some text files.
Looks like that some of our log files are set as binary:
file TuxConnectorURA.20121012
TuxConnectorURA.20121012: data or International Language text
less TuxConnectorURA.20121012... (2 Replies)
I am struck up with a problem and that is with output redirection.
I used all the ways for the redirection of the output of c binary to a file, still it is failing.
Here are the different ways which I have used:
./a.out | tee -a /root/tmp.txt 2>&1
./a.out | tee -a /root/tmp.txt 1>&1
./a.out |... (2 Replies)
Hello,
Can I copy a binary file while the file is being written to by another process?
Another process (program) “P1” creates and opens (for writing) binary file “ABC” on local disk. Process P1 continuously write into ABC file every couple of seconds, adding 512-byte blocks of data. ABC file... (1 Reply)
I am using grep to match a pattern, but the output is strange.
$ grep -r -o "pattern" *
Gives me:
Binary file foo1 matches
Binary file foo2 matches
Binary file foo3 matches
To find the lines before/after, I then have to use the following on each file:
$ strings foo1 | grep -A1 -B1... (0 Replies)
Hi,
I wrote a small script whose function is to execute the postemsg provided if the threshold breaches.
I want to log this postemsg messages to a log file. But I am not able to do. Can someone throw some light on how to log the output of this. I am pasting a snippet of that code.
... (2 Replies)
I have a task that says: make a file (called binaryfile ) that contains
4 bytes of NULL data
6 bytes of random data
8 bytes of 1
10 bytes of 5
and 12 bytes of 9.
For the first 2, I can used :
dd if=/dev/null of=binaryfile bs=8 count =4 and
dd if=/dev/urandom of=binaryfile bs=8... (3 Replies)
Hi,
I have two Solaris machines.
1. SunOS X 5.8 Generic_108528-29 sun4u sparc SUNW,Sun-Blade-1500
2. SunOS Y 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-60
I am trying to buiild a project on both these machines. The Binary output file compiled on machine 2 runs on both the machines. Where... (0 Replies)