Sponsored Content
Full Discussion: Binary and hex in unix
Top Forums Shell Programming and Scripting Binary and hex in unix Post 55876 by Perderabo on Tuesday 21st of September 2004 11:39:42 AM
Old 09-21-2004
ksh can handle hex arithmetic. Try:

Code:
typeset -i16 val
val=16#39e
((val = val & 16#1ff))
echo $val


Last edited by rbatte1; 09-05-2016 at 08:15 AM.. Reason: Added CODE tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Modifying binary file by editing Hex values ?

Hi , i'm using special binary file (lotus notes) and modifying an hexadecimal address range with windows hex editor and it works fine ! The file is an AIX one and i'm forced to transfert (ftp) it before modifying it and re-transfert ! NOW i would do this directly under AIX ! I can... (4 Replies)
Discussion started by: Nicol
4 Replies

2. Shell Programming and Scripting

binary/hex output

i want to output something like 2f 00 00 00 but i can't seem to escape characters like i'm used to in some programming languages, so with this: echo "/\0\0\0" >> outputfile i actually get 2f 5c 30 5c 30 5c 30 0a ie the \0 isn't giving me the 00 i need, and in addition it has got an... (8 Replies)
Discussion started by: peterworth
8 Replies

3. Shell Programming and Scripting

Converting hex value 7C (for pipe) to CRLF in Unix

I am trying to convert a txt file that includes one long string of data. The lines are separated with hex value 7C (for pipe). I am trying to process this file using SQR (Peoplesoft) so I thought the easiest thing to do would be to replace the eol char with a CRLF in unix so I can just... (4 Replies)
Discussion started by: sfedak
4 Replies

4. Programming

After converting the hexstr to Hex and storing the Hex in a char*

Hi All, My main intension of is to convert the Hexstring stored in a char* into hex and then prefixing it with "0x" and suffix it with ',' This has to be done for all the hexstring char* is NULL. Store the result prefixed with "0x" and suffixed with ',' in another char* and pass it to... (1 Reply)
Discussion started by: rvan
1 Replies

5. Shell Programming and Scripting

convert hex to binary and send to variable

Folks, can anyone help with a script to convert hex to binary digits, and break the 32 bit binary into packs of 4 and send them to 8 different variables.Any help is sincerely appreciated. Thanks venu Its in korn shell...... (24 Replies)
Discussion started by: venu
24 Replies

6. Shell Programming and Scripting

Unix Shell scripting, removing hex 0d 0a

hi, I have a file with data like this : 5963491,11926750,Policy Endorsement 1 Policy Endorsement 2 Policy Endorsement 3 Policy Endorsement 4 Policy Endorsement 5 Policy Endorsement 6 Policy Endorsement 7 5963492,11926751,Product.Quote... (10 Replies)
Discussion started by: mrsindhe87
10 Replies

7. Programming

What is the difference between ios::hex and std::hex?

Hi, Is there really a difference between these two, std::hex and ios::hex?? I stumbled upon reading a line, "std::ios::hex is a bitmask (8 on gcc) and works with setf(). std::hex is the operator". Is this true? Thanks (0 Replies)
Discussion started by: royalibrahim
0 Replies

8. Shell Programming and Scripting

Unix - Binary File

Hi All, I am newbie to this forum. I am also new to shell script world. I don't understand the below shell script. File Name: sendFile.sh #!/bin/bash # # This script invokes the Connect:Direct UNIX CLI # and submits a process inline to copy a file to a remote # node. # $1 is... (3 Replies)
Discussion started by: karthi
3 Replies

9. Shell Programming and Scripting

String to HEX conversion in UNIX

i have this below string which i need to convert it to HEX. i have already tried it but it showing extra few things on it.. let me show what i have done and what is the output i am getting and what is the desired output the input string is "!\"\"\"\"\"\"\"!\"\"\"\"\"\"\"" which is... (4 Replies)
Discussion started by: vivek d r
4 Replies

10. Shell Programming and Scripting

Convert Binary File To Hex In Linux

dHi, I have the attached file(actual file can be extracted post unzipping it) & i am trying to use the following code for coversion to hex format. Starting hex value is 84 which is start of the record & termination is done using 00 00 followed by 84(hex) which i can see in the dump clearly using... (14 Replies)
Discussion started by: siramitsharma
14 Replies
EEP24C(1)						      General Commands Manual							 EEP24C(1)

NAME
eep24c - read and write 24Cxxx eeprom devices SYNOPSIS
eep24c -d device [ -r[n] filename | -w[n] filename | -k[n] filename | -f[n] xx ] DESCRIPTION
The command eep24c can be used to read and write 24Cxxx eeprom devices. OPTIONS
The following options are available: -d device Specify the device type. To see a list of the supported devices, try -d help -r filename Read from eeprom and save to a file. -w filename Read from a file and write to eeprom. The addresses not specified in the input file will be filled with 00. -k filename Read from a file and write to eeprom. The addresses not specified in the input file will be kept with its previous values. (this mode is twice slower. It reads whole memory to know previous values, then write whole memory) -f XX Fills the whole eeprom with XX (XX is an hexadecimal value) n Can be used to multiply clock time. If you have a long cable, you may use this option. Example: -r5 will read eeprom 5 times slower (pulse width will be standard value multiplied by 5). Valid range for n is from 1 to 50. Default value is 1. USAGE EXAMPLES
eep24c -d 24c04 -r file.hex read eeprom, write to file.hex eep24c -d 24c04 -r3 file.hex read eeprom, write to file.hex, 3 times slower. eep24c -d 24c04 -w file.hex read file.hex and write to eeprom. All the bytes not found in file.hex will be written as 00. eep24c -d 24c04 -k file.hex read file.hex and write to eeprom. All the bytes not found in file.hex will remain unchanged. eep24c -d 24c04 -f 7A fill eeprom with 7A (hexadecimal). INPUT AND OUTPUT FORMAT
Input and output file format is Intel Hexadecimal Object File Format You can find this specification at ftp://download.intel.com/support/processors/ i960/devtools/INTELHEX.PDF Record types 00 and 01 are implemented in this version. In input lines, LF and CR+LF are accepted as newline markers. Output files are generated with LF as a newline marker. DEVICE SPECIFIC
If you are using Microchip 24*515, you must tie its pin A2 to VCC (needs a hardware modification, see device datasheet). SEE ALSO
ihex2txt(1), txt2ihex(1). AUTHOR
This manual page was written by Pedro Zorzenon Neto <pzn@vztech.com.br>. 2002-11-14 EEP24C(1)
All times are GMT -4. The time now is 02:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy