<?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: ksh script, compare two variables in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789248#M943161</link>
    <description>Harry,&lt;BR /&gt;&lt;BR /&gt;Yeah, I knew I was close, I just had to think about it a while.  The problem with using sed/awk/grep/etc is the performance hit.  &lt;BR /&gt;&lt;BR /&gt;I'm doing Timefinder scripting on an EMC Symmetrix, and I'm trying to get the run time of the script down as low as possible.  We're doing Timefinder splits on a live Informix database (7.3), and the way Informix supports this is to temporarily block writes to disk.  Needless to say, I want to make sure Informix blocks the writes for as short a period as possible.&lt;BR /&gt;&lt;BR /&gt;I've done this in the past (non-grep/etc string compares in ksh), and using the ksh builtins is a HUGE performance boost.  If you're looping through arrays, and have a lot of searches/compares to do, the grep's can add up...&lt;BR /&gt;&lt;BR /&gt;Scott Riley&lt;BR /&gt;Stack Computer, Inc.&lt;BR /&gt;</description>
    <pubDate>Tue, 20 Aug 2002 15:23:25 GMT</pubDate>
    <dc:creator>Stack</dc:creator>
    <dc:date>2002-08-20T15:23:25Z</dc:date>
    <item>
      <title>ksh script, compare two variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789243#M943156</link>
      <description>I've done this before in ksh, but I can't remember how.  &lt;BR /&gt;&lt;BR /&gt;Suppose I have a variable, $str, that contains a bunch of text.  I have another variable, $substr, that contains some other text.&lt;BR /&gt;&lt;BR /&gt;I need to contruct a test to see if $str "contains" $substr.  The trick is, I need to do this with builtins only, no awk, grep, etc.&lt;BR /&gt;&lt;BR /&gt;I recall something with parameter expansion, like testing if ${str%$substr} = $substr....&lt;BR /&gt;&lt;BR /&gt;Help!</description>
      <pubDate>Mon, 19 Aug 2002 22:50:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789243#M943156</guid>
      <dc:creator>Stack</dc:creator>
      <dc:date>2002-08-19T22:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script, compare two variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789244#M943157</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Take a look at the man pages for 'sh-posix'.  You will see shell built-in pattern matching like:&lt;BR /&gt;&lt;BR /&gt;${parameter##pattern}&lt;BR /&gt;${parameter%%pattern}&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 19 Aug 2002 23:09:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789244#M943157</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-08-19T23:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script, compare two variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789245#M943158</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;...and I should add that the Posix shell ('/usr/bin/sh' or '/sbin/sh') is really a superset of the Korn shell ('/usr/bin/ksh').&lt;BR /&gt;&lt;BR /&gt;Hence you could look at either the man pages for 'sh-posix' or those for 'ksh' for more explanation of the shell pattern matching.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 19 Aug 2002 23:16:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789245#M943158</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-08-19T23:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script, compare two variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789246#M943159</link>
      <description>I've got it.  To test to see if $substr is contained in $str, you could use:&lt;BR /&gt;&lt;BR /&gt;[[ "${str%${substr}*}" != "$str" ]] &amp;amp;&amp;amp; echo $substr is within $str&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Aug 2002 23:23:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789246#M943159</guid>
      <dc:creator>Stack</dc:creator>
      <dc:date>2002-08-19T23:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script, compare two variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789247#M943160</link>
      <description>Stack,&lt;BR /&gt;&lt;BR /&gt;good catch! too bad you can't give yourself a ten pointer :-)&lt;BR /&gt;&lt;BR /&gt;One big question, why don't you want to use "normal" pattern matching features like grep, awk, sed, perl ??&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Tue, 20 Aug 2002 00:18:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789247#M943160</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-08-20T00:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script, compare two variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789248#M943161</link>
      <description>Harry,&lt;BR /&gt;&lt;BR /&gt;Yeah, I knew I was close, I just had to think about it a while.  The problem with using sed/awk/grep/etc is the performance hit.  &lt;BR /&gt;&lt;BR /&gt;I'm doing Timefinder scripting on an EMC Symmetrix, and I'm trying to get the run time of the script down as low as possible.  We're doing Timefinder splits on a live Informix database (7.3), and the way Informix supports this is to temporarily block writes to disk.  Needless to say, I want to make sure Informix blocks the writes for as short a period as possible.&lt;BR /&gt;&lt;BR /&gt;I've done this in the past (non-grep/etc string compares in ksh), and using the ksh builtins is a HUGE performance boost.  If you're looping through arrays, and have a lot of searches/compares to do, the grep's can add up...&lt;BR /&gt;&lt;BR /&gt;Scott Riley&lt;BR /&gt;Stack Computer, Inc.&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Aug 2002 15:23:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-compare-two-variables/m-p/2789248#M943161</guid>
      <dc:creator>Stack</dc:creator>
      <dc:date>2002-08-20T15:23:25Z</dc:date>
    </item>
  </channel>
</rss>

