<?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: check string feature in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/check-string-feature/m-p/4951153#M413530</link>
    <description>&lt;BR /&gt;When can leverage the enhanced grep command to match an anchored string.&lt;BR /&gt;&lt;BR /&gt;checkvar()&lt;BR /&gt;{&lt;BR /&gt;  typeset -i GSTAT=2&lt;BR /&gt;  if [[ ${#} -eq 1 ]]&lt;BR /&gt;    then&lt;BR /&gt;      typeset X=${1}&lt;BR /&gt;      shift&lt;BR /&gt;      echo "${X}" | grep -E -q -e '^[A-Za-z0-9]{5}[0-9]{3}$'&lt;BR /&gt;      GSTAT=${?}&lt;BR /&gt;    fi&lt;BR /&gt;  return ${GSTAT}&lt;BR /&gt;} # checkvar&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;read MYVAR&lt;BR /&gt;checkvar ${MYVAR}&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "Ok"&lt;BR /&gt;  else&lt;BR /&gt;    echo "Bad format"&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;Man grep for details.&lt;BR /&gt;</description>
    <pubDate>Tue, 10 Jan 2006 10:21:01 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2006-01-10T10:21:01Z</dc:date>
    <item>
      <title>check string feature</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-string-feature/m-p/4951151#M413528</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;I need to check that a variable read by a posix shell script is as follows&lt;BR /&gt;length 8,&lt;BR /&gt;first 5 digits are alfanumeric&lt;BR /&gt;last 3 digits are numeric&lt;BR /&gt;&lt;BR /&gt;any help apprciated.&lt;BR /&gt;Thanks&lt;BR /&gt;Angelo</description>
      <pubDate>Tue, 10 Jan 2006 10:07:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-string-feature/m-p/4951151#M413528</guid>
      <dc:creator>SILVERSTAR</dc:creator>
      <dc:date>2006-01-10T10:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: check string feature</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-string-feature/m-p/4951152#M413529</link>
      <description>There may be a more condensed syntax for this, but this works:&lt;BR /&gt;&lt;BR /&gt;case ${VARIABLE} in&lt;BR /&gt;[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][0-9][0-9][0-9]) echo "Good value" ;;&lt;BR /&gt;*) echo "Bad value" ;;&lt;BR /&gt;esac</description>
      <pubDate>Tue, 10 Jan 2006 10:15:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-string-feature/m-p/4951152#M413529</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2006-01-10T10:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: check string feature</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-string-feature/m-p/4951153#M413530</link>
      <description>&lt;BR /&gt;When can leverage the enhanced grep command to match an anchored string.&lt;BR /&gt;&lt;BR /&gt;checkvar()&lt;BR /&gt;{&lt;BR /&gt;  typeset -i GSTAT=2&lt;BR /&gt;  if [[ ${#} -eq 1 ]]&lt;BR /&gt;    then&lt;BR /&gt;      typeset X=${1}&lt;BR /&gt;      shift&lt;BR /&gt;      echo "${X}" | grep -E -q -e '^[A-Za-z0-9]{5}[0-9]{3}$'&lt;BR /&gt;      GSTAT=${?}&lt;BR /&gt;    fi&lt;BR /&gt;  return ${GSTAT}&lt;BR /&gt;} # checkvar&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;read MYVAR&lt;BR /&gt;checkvar ${MYVAR}&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "Ok"&lt;BR /&gt;  else&lt;BR /&gt;    echo "Bad format"&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;Man grep for details.&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Jan 2006 10:21:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-string-feature/m-p/4951153#M413530</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-01-10T10:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: check string feature</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-string-feature/m-p/4951154#M413531</link>
      <description>&lt;BR /&gt;Similar in perl:&lt;BR /&gt;&lt;BR /&gt;perl -e 'exit (@ARGV[0] =~ /^[A-Za-z0-9]{5}\d{3}$/)' $your_variable&lt;BR /&gt;&lt;BR /&gt;This sets $? to 1 on match, 0 else.&lt;BR /&gt;&lt;BR /&gt;Are you sure you mean Alphanumeric in those first 5, or perhaps just Alpha&lt;BR /&gt;Alpha: [A-Za-z]&lt;BR /&gt;AlphaNumeric: [A-Za-z0-9]&lt;BR /&gt;&lt;BR /&gt;And if alpha-numeric, with "_" is allowed then you can use \w in perl:&lt;BR /&gt;&lt;BR /&gt;perl -e 'exit (@ARGV[0] =~ /^\w{5}\d{3}$/)' $your_variable&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Jan 2006 10:57:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-string-feature/m-p/4951154#M413531</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-01-10T10:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: check string feature</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-string-feature/m-p/4951155#M413532</link>
      <description>well done</description>
      <pubDate>Tue, 10 Jan 2006 11:03:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-string-feature/m-p/4951155#M413532</guid>
      <dc:creator>SILVERSTAR</dc:creator>
      <dc:date>2006-01-10T11:03:23Z</dc:date>
    </item>
  </channel>
</rss>

