<?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: Search in ksh array in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251779#M714784</link>
    <description>I have following solution&lt;BR /&gt;&lt;BR /&gt;testa[0]=first&lt;BR /&gt;testa[1]=second&lt;BR /&gt;echo ${testa[1]}&lt;BR /&gt;echo ${testa[*]} | grep first &amp;gt;/dev/null&lt;BR /&gt;echo $?&lt;BR /&gt;echo ${testa[*]} | grep third &amp;gt;/dev/null&lt;BR /&gt;echo $?&lt;BR /&gt;&lt;BR /&gt;It will give following output&lt;BR /&gt;&lt;BR /&gt;second&lt;BR /&gt;0      # true&lt;BR /&gt;1      # false&lt;BR /&gt;&lt;BR /&gt;sks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 19 Apr 2004 03:38:00 GMT</pubDate>
    <dc:creator>Sanjay Kumar Suri</dc:creator>
    <dc:date>2004-04-19T03:38:00Z</dc:date>
    <item>
      <title>Search in ksh array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251778#M714782</link>
      <description>Hi&lt;BR /&gt;   I have an array containing string entries&lt;BR /&gt;arr[0]=Entry1&lt;BR /&gt;arr[1]=Entry2&lt;BR /&gt;.&lt;BR /&gt;    When given any string I need to check if that string is present in this array. In there any way of doing it apart from looping over the whole array.&lt;BR /&gt;  Like in TCL we have,"array exists &lt;ENTRY&gt;" Is there something of this syntax in ksh.&lt;BR /&gt;Any ideas or suggestions most welcome.&lt;BR /&gt;&lt;BR /&gt;- Praveen&lt;/ENTRY&gt;</description>
      <pubDate>Mon, 19 Apr 2004 03:20:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251778#M714782</guid>
      <dc:creator>Praveen Bezawada</dc:creator>
      <dc:date>2004-04-19T03:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Search in ksh array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251779#M714784</link>
      <description>I have following solution&lt;BR /&gt;&lt;BR /&gt;testa[0]=first&lt;BR /&gt;testa[1]=second&lt;BR /&gt;echo ${testa[1]}&lt;BR /&gt;echo ${testa[*]} | grep first &amp;gt;/dev/null&lt;BR /&gt;echo $?&lt;BR /&gt;echo ${testa[*]} | grep third &amp;gt;/dev/null&lt;BR /&gt;echo $?&lt;BR /&gt;&lt;BR /&gt;It will give following output&lt;BR /&gt;&lt;BR /&gt;second&lt;BR /&gt;0      # true&lt;BR /&gt;1      # false&lt;BR /&gt;&lt;BR /&gt;sks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Apr 2004 03:38:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251779#M714784</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-04-19T03:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Search in ksh array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251780#M714786</link>
      <description>It might help to first check, if the entry is in the array and do the looping only if there was something found.&lt;BR /&gt;&lt;BR /&gt;if `echo ${arr[*]} | grep searchstring \&lt;BR /&gt;2&amp;gt;&amp;amp;1 &amp;gt;/dev/null`&lt;BR /&gt; then &lt;BR /&gt;   go looping &lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;[i hope the [*] was the correct way to address every value in the array, can't test it right now.]</description>
      <pubDate>Mon, 19 Apr 2004 03:49:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251780#M714786</guid>
      <dc:creator>Florian Heigl (new acc)</dc:creator>
      <dc:date>2004-04-19T03:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Search in ksh array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251781#M714787</link>
      <description>Check this as well:&lt;BR /&gt;&lt;BR /&gt;testa[0]=first&lt;BR /&gt;testa[1]=second&lt;BR /&gt;if `echo ${testa[*]} | grep ${testa[0]} &amp;gt; /dev/null`&lt;BR /&gt;then&lt;BR /&gt;echo "successful"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;sks&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Apr 2004 03:59:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251781#M714787</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-04-19T03:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: Search in ksh array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251782#M714788</link>
      <description>and perhaps &lt;BR /&gt;grep -x &lt;BR /&gt;won't hurt.</description>
      <pubDate>Mon, 19 Apr 2004 04:01:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251782#M714788</guid>
      <dc:creator>Praveen Bezawada</dc:creator>
      <dc:date>2004-04-19T04:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Search in ksh array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251783#M714789</link>
      <description>No. It is hurting.&lt;BR /&gt;&lt;BR /&gt;testa[0]=first&lt;BR /&gt;testa[1]=second&lt;BR /&gt;if `echo ${testa[*]} | grep -x ${testa[0]} &amp;gt; /dev/null`&lt;BR /&gt;then&lt;BR /&gt;echo "successful"&lt;BR /&gt;else&lt;BR /&gt;echo "unsuccessful"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;sks&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Apr 2004 04:11:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-in-ksh-array/m-p/3251783#M714789</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-04-19T04:11:54Z</dc:date>
    </item>
  </channel>
</rss>

