Sponsored Content
Top Forums Shell Programming and Scripting Covert Deci to Hex (New to AWK) Post 73647 by Linda_H on Friday 3rd of June 2005 02:05:51 AM
Old 06-03-2005
Hi vgersh99,

Thks for the help. I finally applied it succesfully today.

But, here comes another seperate but related problem. This time, I tried to convert from a Hex to Deci number by creating a new script with "%d" on the hex number, but it failed.

I need to convert a file with these,

ABC c001 DEF
ABC c050 EFG
ABC c802 GHI

to

ABC 49153 DEF
ABC 49232 EFG
ABC 51202 GHI

Please help me again.
Thank you!!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK and hex sequences

for file in `seq 1 256`; do printf "\x$file -- $file" ; done ; printf "\n" produces the wrong output. I want to show the ascii codes but need to output a hexidecimal number sequence. I know I should use awk to do this but i'm not sure how cause I forget. what is the awk equivelant of seq... (5 Replies)
Discussion started by: JoeTheGuy
5 Replies

2. 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

3. 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

4. Shell Programming and Scripting

awk to remove leading zeros for a hex number

Is it possible by using awk to remove leading zeros for a hex number? ex: 0000000011179E0A -> 11179E0A Thank you! (4 Replies)
Discussion started by: carloszhang
4 Replies

5. UNIX for Dummies Questions & Answers

How to specify a FS as HEX value in AWK

Hi All, I have one input file seperated with Hex decimal B1 value. And i want to process this file. And iam creating an awk script to process this file. How can I specify the Field seperator as HEX B1 in my awk. Please help. Thanks in advance.:) (2 Replies)
Discussion started by: psk_kumar
2 Replies

6. Shell Programming and Scripting

Range of numbers in HEX using AWK

Hi , How do i found out all the number in a range ( HEX) for example Input is 15CF:15D2 Output needed 15CF 15D0 15D1 15D2 Thanks (2 Replies)
Discussion started by: greycells
2 Replies

7. Shell Programming and Scripting

how to get data from hex file using SED or AWK based on pattern sign

I have a binary (hex) file I need to parse to get some data which are encoded this way: .* b4 . . . 01 12 .* af .* 83 L1 x1 x2 xL 84 L2 y1 y2 yL By another words there is a stream of hexadecimal bytes (in my example separated by space for better readability). I need to get value stored in... (3 Replies)
Discussion started by: sameucho
3 Replies

8. Shell Programming and Scripting

awk to compare hex number

$ awk 'BEGIN{ pat111=0x1000000002E3E02; snBegin=0x1000000002E3E01; if (pat111<=snBegin) printf "a\n"}' a Result is not correct. Looks like the number is too big. Any idea? Thx! Please use code tags <- click the link! (2 Replies)
Discussion started by: carloszhang
2 Replies

9. HP-UX

Replacing Hex Characters In A File Using awk?

Hi guys, First off, i'm a complete noob to UNIX and LINUX so apologies if I don't understand the basics! I have a file which contains a hex value of '0D' at the end of each line when I look at it in a hex viewer. I need to change it so it contains a hex value of '0D0A0A' I thought... (10 Replies)
Discussion started by: AndyBSG
10 Replies

10. Shell Programming and Scripting

Print hex Ip address in decimal format inside awk script

Hi to all, May someone help me with the following. The awk script below is part of a bigger awk script, and this part attempts to print an Ip address that is in hex format in decimal format. I'm trying with following code but I'm getting 0.0.0.0 and the correct answer is 192.168.140.100 ... (9 Replies)
Discussion started by: Ophiuchus
9 Replies
KAS_STRINGTOKEY(8)					       AFS Command Reference						KAS_STRINGTOKEY(8)

NAME
kas_stringtokey - Converts a character string into an octal key SYNOPSIS
kas stringtokey -string <password string> [-cell <cell name>] [-help] kas str -s <password string> [-c <cell name>] [-h] DESCRIPTION
The kas stringtokey command converts the character string specified with the -string argument into an octal string suitable for use as an encryption key. The kas command interpreter generates the octal key by using an encryption algorithm on the combination of the specified string and the name of the local cell (as recorded in the local /etc/openafs/ThisCell file). Use the -cell argument to convert a string into a key appropriate for a cell other than the local one. CAUTIONS
This command writes the key to the standard output stream, on which it can possibly be intercepted by third parties. It is not very secure to use the key in an actual Authentication Database entry. OPTIONS
-string <password string> Specifies the character string to convert into an octal key. -cell <cell name> Specifies the complete Internet domain name of the cell to combine with the password string while generating the key. If this argument is omitted, the kas command interpreter determines the name of the local cell by consulting: o First, the value of the environment variable AFSCELL. o Second, the cellname in the /etc/openafs/ThisCell file on the local machine. -help Prints the online help for this command. All other valid options are ignored. OUTPUT
The output is of the following form: Converting I<password string> in realm 'I<cell_name>' yields key='I<key>'. EXAMPLES
The following example shows the octal key equivalent of the string "new_pswd" in the ABC Corporation cell. % kas stringtokey new_pswd Converting new_pswd in realm 'ABC.COM' yields key='346307364320263233342354'. PRIVILEGE REQUIRED
None, and no password is required. SEE ALSO
ThisCell(5), kas(8) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 KAS_STRINGTOKEY(8)
All times are GMT -4. The time now is 04:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy