<?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: Numeric validation in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665300#M930968</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;This is one method:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh &lt;BR /&gt;typeset X=$1 &lt;BR /&gt;if [ `expr "$X" : '[0-9,\-]*'` -ne `expr "$X" : '.*'` ] &lt;BR /&gt;then &lt;BR /&gt;echo "not a number!" &lt;BR /&gt;else &lt;BR /&gt;echo "ok, is a number!" &lt;BR /&gt;fi &lt;BR /&gt;#.end. &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Thu, 14 Feb 2002 22:38:58 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2002-02-14T22:38:58Z</dc:date>
    <item>
      <title>Numeric validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665299#M930967</link>
      <description>Is there an existing shell script out there to check for a 3 digit field to be numeric?&lt;BR /&gt;TIA.</description>
      <pubDate>Thu, 14 Feb 2002 22:35:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665299#M930967</guid>
      <dc:creator>bhoang</dc:creator>
      <dc:date>2002-02-14T22:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665300#M930968</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;This is one method:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh &lt;BR /&gt;typeset X=$1 &lt;BR /&gt;if [ `expr "$X" : '[0-9,\-]*'` -ne `expr "$X" : '.*'` ] &lt;BR /&gt;then &lt;BR /&gt;echo "not a number!" &lt;BR /&gt;else &lt;BR /&gt;echo "ok, is a number!" &lt;BR /&gt;fi &lt;BR /&gt;#.end. &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 14 Feb 2002 22:38:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665300#M930968</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-02-14T22:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665301#M930969</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Here is another method:&lt;BR /&gt;&lt;BR /&gt;#/sbin/sh&lt;BR /&gt;expr `echo $1|awk -F\. '{print $1$2}'` + 0&lt;BR /&gt;if [ "$?" != 0 ]&lt;BR /&gt;then&lt;BR /&gt;  echo is NOT a number&lt;BR /&gt;else&lt;BR /&gt;  echo is a number&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Fri, 15 Feb 2002 02:21:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665301#M930969</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-02-15T02:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665302#M930970</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;this one is faster since no additional processes are started:&lt;BR /&gt;&lt;BR /&gt;case "$1" in&lt;BR /&gt;   [0-9][0-9][0-9]) echo "3digit numeric" ;;&lt;BR /&gt;   *) echo "NOT 3digit numeric" ;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Wodisch</description>
      <pubDate>Fri, 15 Feb 2002 04:08:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665302#M930970</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2002-02-15T04:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665303#M930971</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I agree with Wodisch, if only plain 3-digit places are required. If you want to also take care of decimal places and negatives, JRF's script takes care of them and any number of digits. Mine too.&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Fri, 15 Feb 2002 04:14:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665303#M930971</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-02-15T04:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665304#M930972</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;there is a possibility which is even faster:&lt;BR /&gt;&lt;BR /&gt;if (($1+1)) &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;then&lt;BR /&gt;     echo "$1 is a number!"&lt;BR /&gt;else&lt;BR /&gt;     echo "$1 is something else&lt;BR /&gt;fi&lt;BR /&gt;     &lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Fri, 15 Feb 2002 07:42:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665304#M930972</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-02-15T07:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665305#M930973</link>
      <description>...and another way, n is the number of digits to look for:&lt;BR /&gt;&lt;BR /&gt;# a=123&lt;BR /&gt;# n=3&lt;BR /&gt;echo $a | grep -E "^[0-9]{$n}$"&lt;BR /&gt;123&lt;BR /&gt;# n=4&lt;BR /&gt;# echo $a | grep -E "^[0-9]{$n}$"&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Fri, 15 Feb 2002 08:13:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/numeric-validation/m-p/2665305#M930973</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-02-15T08:13:26Z</dc:date>
    </item>
  </channel>
</rss>

