<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: character to numeric representation in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148769#M318501</link>
    <description>Yes, I figured out that 61 from the table&lt;BR /&gt;is the oct rep of the letter "a"&lt;BR /&gt;&lt;BR /&gt;# perl -le 'printf "%c", 0x61'&lt;BR /&gt;a&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And you confirmed that dec of "a" is 97.&lt;BR /&gt;&lt;BR /&gt;# perl -le 'printf "%c", 97'&lt;BR /&gt;a&lt;BR /&gt;&lt;BR /&gt;So your dec conversion line will work just&lt;BR /&gt;fine to convert any characters to dec.&lt;BR /&gt;&lt;BR /&gt;dec output is what I was looking for. So&lt;BR /&gt;for the letter "a" it is 97. "b" 98, etc..&lt;BR /&gt;&lt;BR /&gt;# printf a &lt;BR /&gt;          97&lt;BR /&gt;&lt;BR /&gt;I'll just run what is found as $a in&lt;BR /&gt;&lt;BR /&gt;# numval=`printf $char | xd -An -td1`&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks as always. Ya'll are so good.</description>
    <pubDate>Fri, 22 Feb 2008 00:53:18 GMT</pubDate>
    <dc:creator>jerry1</dc:creator>
    <dc:date>2008-02-22T00:53:18Z</dc:date>
    <item>
      <title>character to numeric representation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148763#M318495</link>
      <description>Does anyone know how to convert a character&lt;BR /&gt;string or letter to decimal representation.&lt;BR /&gt;&lt;BR /&gt;e.g. a = ?&lt;BR /&gt;    1a = ?</description>
      <pubDate>Thu, 21 Feb 2008 22:10:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148763#M318495</guid>
      <dc:creator>jerry1</dc:creator>
      <dc:date>2008-02-21T22:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: character to numeric representation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148764#M318496</link>
      <description>For one occruance, Or in a script?&lt;BR /&gt;&lt;BR /&gt;For a quick lookup I use (a clone from) &lt;A href="http://www.asciitable.com/" target="_blank"&gt;http://www.asciitable.com/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Google: asciitable.&lt;BR /&gt;&lt;BR /&gt;For scripts I use whatever the language offers. For example in perl:&lt;BR /&gt;&lt;BR /&gt;$ perl -e 'print chr(65)'&lt;BR /&gt;and &lt;BR /&gt;$ perl -le 'print ord("C")'&lt;BR /&gt;&lt;BR /&gt;or &lt;BR /&gt;&lt;BR /&gt;$ perl -le 'printf "%c", 0x43'&lt;BR /&gt;&lt;BR /&gt;Enjoy!&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Feb 2008 23:10:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148764#M318496</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-02-21T23:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: character to numeric representation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148765#M318497</link>
      <description>Used in a korn shell script.&lt;BR /&gt;grep'ng for particular string which may&lt;BR /&gt;have string -11 or -1a , etc...&lt;BR /&gt;&lt;BR /&gt;11 in -11 is used as index number in array &lt;BR /&gt;when that string is found. Can't use 1a &lt;BR /&gt;unless "a" is converted to it's decimal&lt;BR /&gt;representation.&lt;BR /&gt;So if "a" is 61 or 141, according to&lt;BR /&gt;/usr/share/lib/pub/ascii, then the value for&lt;BR /&gt;1a that I would need would be 161 or 1141.</description>
      <pubDate>Thu, 21 Feb 2008 23:21:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148765#M318497</guid>
      <dc:creator>jerry1</dc:creator>
      <dc:date>2008-02-21T23:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: character to numeric representation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148766#M318498</link>
      <description>Hi Jerry"&lt;BR /&gt;&lt;BR /&gt;Depending on your needs, you should also find 'xd' (also known as 'od') useful.  You can list a file in hexadecimal, octal, or decimal:&lt;BR /&gt;&lt;BR /&gt;# xd -tax /etc/hosts&lt;BR /&gt;&lt;BR /&gt;# xd -tao /etc/hosts&lt;BR /&gt;&lt;BR /&gt;# xd -tad /etc/hosts&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 22 Feb 2008 00:21:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148766#M318498</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-02-22T00:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: character to numeric representation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148767#M318499</link>
      <description>I must be a little dense today.&lt;BR /&gt;That explanaiton does nto really cut it for me.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; may have string -11 or -1a , etc...&lt;BR /&gt;&lt;BR /&gt;What is the exact range?&lt;BR /&gt;Can it return 1A or A1 or 1$ or 1!&lt;BR /&gt;uppercae or lowercase?&lt;BR /&gt;&lt;BR /&gt;I get the feeling that it will only return 0..9 or a..z&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In that case you can use the shell base#n conversion for base 36.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$ let x=36#a&lt;BR /&gt;$ echo $x&lt;BR /&gt;10&lt;BR /&gt;$ let x=36#z&lt;BR /&gt;$ echo $x&lt;BR /&gt;35&lt;BR /&gt;$ let x=36#3&lt;BR /&gt;$ echo $x&lt;BR /&gt;3&lt;BR /&gt;&lt;BR /&gt;So if "a" is 61 or 141, according to&lt;BR /&gt;&lt;BR /&gt;It is not 61 or 141 is 16#61 AND 8#141&lt;BR /&gt;In other words, its OCTAL value is 141&lt;BR /&gt;It's HEX value 61 and its decimal value is 97.&lt;BR /&gt;&lt;BR /&gt;/usr/share/lib/pub/ascii, then the value for&lt;BR /&gt;1a that I would need would be 161 or 1141.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;btw..&lt;BR /&gt;&lt;BR /&gt;here is an other, 'shell only' way to convert a character to its octal value string: &lt;BR /&gt;x=$( printf a | od -An -to1 )&lt;BR /&gt;$ echo $x&lt;BR /&gt;&lt;BR /&gt;and back&lt;BR /&gt;&lt;BR /&gt;$ echo "\0141"&lt;BR /&gt;a&lt;BR /&gt;&lt;BR /&gt;hex: x=$(printf a | xd -An -tx1)&lt;BR /&gt;decimal: x=$(printf a | xd -An -td1)&lt;BR /&gt;&lt;BR /&gt;What is the _real_ problem you are trying to solve. Mayb a shell script is not the optimal way to approach this. String manipulation tends to be a lot easier within AWK or PERL or such.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Feb 2008 00:29:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148767#M318499</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-02-22T00:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: character to numeric representation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148768#M318500</link>
      <description>Yes, I figured out that 61 from the table&lt;BR /&gt;is the oct rep of the letter "a"&lt;BR /&gt;&lt;BR /&gt;# perl -le 'printf "%c", 0x61'&lt;BR /&gt;a&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And you confirmed that dec of "a" is 97.&lt;BR /&gt;&lt;BR /&gt;# perl -le 'printf "%c", 97'&lt;BR /&gt;a&lt;BR /&gt;&lt;BR /&gt;So your dec conversion line will work just&lt;BR /&gt;fine to convert any characters to dec.&lt;BR /&gt;&lt;BR /&gt;dec output is what I was looking for. So&lt;BR /&gt;for the letter "a" it is 97. "b" 98, etc..&lt;BR /&gt;&lt;BR /&gt;# printf a &lt;BR /&gt;          97&lt;BR /&gt;&lt;BR /&gt;I'll just run what is found as $a in&lt;BR /&gt;&lt;BR /&gt;# numval=`printf $a | xd -An -td1`&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks as always. Ya'll are so good.</description>
      <pubDate>Fri, 22 Feb 2008 00:53:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148768#M318500</guid>
      <dc:creator>jerry1</dc:creator>
      <dc:date>2008-02-22T00:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: character to numeric representation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148769#M318501</link>
      <description>Yes, I figured out that 61 from the table&lt;BR /&gt;is the oct rep of the letter "a"&lt;BR /&gt;&lt;BR /&gt;# perl -le 'printf "%c", 0x61'&lt;BR /&gt;a&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And you confirmed that dec of "a" is 97.&lt;BR /&gt;&lt;BR /&gt;# perl -le 'printf "%c", 97'&lt;BR /&gt;a&lt;BR /&gt;&lt;BR /&gt;So your dec conversion line will work just&lt;BR /&gt;fine to convert any characters to dec.&lt;BR /&gt;&lt;BR /&gt;dec output is what I was looking for. So&lt;BR /&gt;for the letter "a" it is 97. "b" 98, etc..&lt;BR /&gt;&lt;BR /&gt;# printf a &lt;BR /&gt;          97&lt;BR /&gt;&lt;BR /&gt;I'll just run what is found as $a in&lt;BR /&gt;&lt;BR /&gt;# numval=`printf $char | xd -An -td1`&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks as always. Ya'll are so good.</description>
      <pubDate>Fri, 22 Feb 2008 00:53:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/character-to-numeric-representation/m-p/4148769#M318501</guid>
      <dc:creator>jerry1</dc:creator>
      <dc:date>2008-02-22T00:53:18Z</dc:date>
    </item>
  </channel>
</rss>

