Re: Which command can transfer a character to hex?

From: Bill Thompson (bill.thompson@GOODYEAR.COM)
Date: Tue Jul 01 2003 - 07:10:47 EDT


Here's one way: perl -e 'printf "%X\n", ord("A");'

This will return the hexadecimal representation of the ASCII character "A"
(41).

If you want to script this (ksh) you could do something like this:

- - - - - snip - - - - -
#!/bin/sh

export CHAR="B"

HEX=$(perl -e 'printf "%X\n", ord($ENV{CHAR});')

print "$CHAR = $HEX"
- - - - - snip - - - - -

HTH

Bill Thompson
Sr UNIX Systems Administrator
The Goodyear Tire & Rubber Co.

Contains Confidential and/or Proprietary Information
May Not Be Copied or Disseminated Without Express Consent of The Goodyear
Tire & Rubber Company.

AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2

----- Original Message -----
From: "augusta Zhou" <meijun_Zhou@SHANGHAIGM.COM>
Newsgroups: bit.listserv.aix-l
To: <aix-l@Princeton.EDU>
Sent: Monday, June 30, 2003 8:56 PM
Subject: Which command can trasfer a character to hex?

> hi, list
>
> I'm search for a command which can transfer a character to hex code..
>
> Thanks in advance.
>
>
> Best Regards.
> Zhou Meijun
>
> IS Department
> Shanghai General Motors Co., Ltd.
>
> Tel: (021)28902879
> Fax: (021)50317990
> E-mail: meijun_zhou@shanghaigm.com
>
>
>
> ***********************************************************
> SGM Proprietary
>
> The information contained in this electronic communication and its
attachments (if any) is confidential and subject to legal privilege. The
information is intended only for use of the individuals to whom it is
addressed. If you are not an intended recipient, or the agent or employee
responsible to deliver it to an intended recipient, you are hereby notified
that any use, dissemination, distribution or copying of this communication
is strictly prohibited. If you have received this electronic communication
in error, please delete it and immediately notify me by sending a return
e-mail to the address in this e-mail. Thank you.
> ***********************************************************



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:58 EDT