04-03-2012
Users can enter query in decimal. You just need to change the decimal to a suitable matching hexadecimal format.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello !
Does anyone knows how can I convert hexadecimal to decimal base in the ksh or csh script ??
Thanks !
Witt (1 Reply)
Discussion started by: witt
1 Replies
2. Shell Programming and Scripting
Hi frnds :)
I need a small help...
I have a very long file containing 20 digits decimal number which i want to convert into the corresponding 16 digit hexadecimal values.
File looks like....
11908486672755551741
05446378739602232559
04862605079740156652
.
.
.
I tried the script
for i... (7 Replies)
Discussion started by: vanand420
7 Replies
3. UNIX for Dummies Questions & Answers
Hi all,
I have a small script to convert my HexaDecimal Input to Decimal as output.
#!/bin/ksh
hd=00208060
dec=`printf %d $hd`
echo $dec
Output of the above program:
printf: 00208060 not completely converted
16
But my expected output is "2130016".
How can i acheive this.
I... (2 Replies)
Discussion started by: Arunprasad
2 Replies
4. Shell Programming and Scripting
Hello everybody,
I would like to understand why the printf function is returning me an octal value with this command :
printf %4.4d 0010 returns 0008
printf %4.4d 10 returns 0010
Thanks for help. (3 Replies)
Discussion started by: dolphin06
3 Replies
5. Shell Programming and Scripting
printf "%X\n" "A"
41
printf "%X\n" "2"
2
Expected 32 (not 2).
Is there a "printf" which will output the hexadecimal value of a numeric character? (9 Replies)
Discussion started by: methyl
9 Replies
6. Shell Programming and Scripting
hi all,
this is my script:
#! /bin/sh
minutes=$( { i2cget -f -y 0 0x51 3; } 2>&1 )
minutes=${minutes:2}
hour=$( { i2cget -f -y 0 0x51 4; } 2>&1 )
hour=${hour:2}
day=$( { i2cget -f -y 0 0x51 5; } 2>&1 )
day=${day:2}
month=$( { i2cget -f -y 0 0x51 7; } 2>&1 )
month=${month:2}
... (6 Replies)
Discussion started by: enaud
6 Replies
7. Shell Programming and Scripting
Hi Experts,
Quick question:
I am trying to get the output with decimal and floating point but not working:
echo "20.03" | awk '{printf "%03d.2f\n" , $0 }'
020.2f
How to get the output as :
020.03
Thank you. (4 Replies)
Discussion started by: rveri
4 Replies
8. Shell Programming and Scripting
Hi Guys,
Is it possible to convert the hexadecimal to Binary by unix command.....I could not figure out....
If I need to convert AF6D to binary...what could be the way to do?
Thanks in advance!!
---------- Post updated at 02:57 AM ---------- Previous update was at 02:42 AM ----------
I... (6 Replies)
Discussion started by: Indra2011
6 Replies
9. Shell Programming and Scripting
How can I convert hexadecimal values to Binary from the second field to the end
Input:
WS-2 23 345 235
DT-3 45 4A3 000
pp-2 76 300 E4
Output:
WS-2 100011 1101000101 1000110101
DT-3 1000101 10010100011 000
pp-2 1110110 1100000000 11100100 (16 Replies)
Discussion started by: aydj
16 Replies
10. UNIX for Dummies Questions & Answers
Hi All,
cat filename | awk '{print $1, $2, $4, $5, $6, $7, $8, $9, $10;}' | awk 'NF > 0'
OUTPUT:
2015-01-19 00:12:32 00000000fbfa0000 000000009ae5cf80 014d 015d 0017 003c 0362de20
2015-01-19 00:13:52 00000000fc820000 00000000994c6758 014c 015d 000b 003c 08670250
2015-01-19 00:14:25... (12 Replies)
Discussion started by: sam@sam
12 Replies
NS(3N) NS(3N)
NAME
ns_addr, ns_ntoa - Xerox NS(tm) address conversion routines
SYNOPSIS
#include <sys/types.h>
#include <netns/ns.h>
struct ns_addr ns_addr(cp)
char *cp;
char *ns_ntoa(ns)
struct ns_addr ns;
DESCRIPTION
The routine ns_addr interprets character strings representing XNS addresses, returning binary information suitable for use in system calls.
ns_ntoa takes XNS addresses and returns ASCII strings representing the address in a notation in common use in the Xerox Development Envi-
ronment:
<network number>.<host number>.<port number>
Trailing zero fields are suppressed, and each number is printed in hexadecimal, in a format suitable for input to ns_addr. Any fields
lacking super-decimal digits will have a trailing ``H'' appended.
Unfortunately, no universal standard exists for representing XNS addresses. An effort has been made to insure that ns_addr be compatible
with most formats in common use. It will first separate an address into 1 to 3 fields using a single delimiter chosen from period (``.''),
colon (``:'') or pound-sign (``#''). Each field is then examined for byte separators (colon or period). If there are byte separators,
each subfield separated is taken to be a small hexadecimal number, and the entirety is taken as a network-byte-ordered quantity to be zero
extended in the high-network-order bytes. Next, the field is inspected for hyphens, in which case the field is assumed to be a number in
decimal notation with hyphens separating the millenia. Next, the field is assumed to be a number: It is interpreted as hexadecimal if
there is a leading ``0x'' (as in C), a trailing ``H'' (as in Mesa), or there are any super-decimal digits present. It is interpreted as
octal is there is a leading ``0'' and there are no super-octal digits. Otherwise, it is converted as a decimal number.
SEE ALSO
hosts(5), networks(5),
DIAGNOSTICS
None (see BUGS).
BUGS
The string returned by ns_ntoa resides in a static memory area.
ns_addr should diagnose improperly formed input, and there should be an unambiguous way to recognize this.
4.3 Berkeley Distribution May 12, 1986 NS(3N)