<?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: Optimization/Speed up help needed on the script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586478#M679409</link>
    <description>Hi Patrick,&lt;BR /&gt;&lt;BR /&gt;I did not answer for your question, Sorry for that.&lt;BR /&gt;&lt;BR /&gt;What is the actual script name?&lt;BR /&gt;&lt;BR /&gt;testpattern.sh&lt;BR /&gt;&lt;BR /&gt;Yes, I'm using this for Openview monitoring template only. If any suggestions, Pls add to it.</description>
    <pubDate>Thu, 18 Feb 2010 16:49:22 GMT</pubDate>
    <dc:creator>Gobinathan</dc:creator>
    <dc:date>2010-02-18T16:49:22Z</dc:date>
    <item>
      <title>Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586464#M679395</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I am attaching the script that takes more CPU usage. &lt;BR /&gt;&lt;BR /&gt;Could you pls anybody help here to optimize the script in the way to reduce the burden on the CPU.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Gobinathan.S</description>
      <pubDate>Thu, 18 Feb 2010 14:53:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586464#M679395</guid>
      <dc:creator>Gobinathan</dc:creator>
      <dc:date>2010-02-18T14:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586465#M679396</link>
      <description>It's a small script only but contains so many if then loops. &lt;BR /&gt;&lt;BR /&gt;Anybody pls help me here, Points would be granted and appreciate on your valuble answer.</description>
      <pubDate>Thu, 18 Feb 2010 14:57:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586465#M679396</guid>
      <dc:creator>Gobinathan</dc:creator>
      <dc:date>2010-02-18T14:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586466#M679397</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Your script isn't doing a great deal of work expect for whatever 'opcmon' does.&lt;BR /&gt;&lt;BR /&gt;For cases like:&lt;BR /&gt;&lt;BR /&gt;# CMD_OUTPUT=`cat $SEARCH_NAME | grep -i "$4" | wc -l`&lt;BR /&gt;&lt;BR /&gt;...you can eliminate a couple of processes by doing:&lt;BR /&gt;&lt;BR /&gt;# CMD_OUTPUT=$(grep -c -i "$4" ${SEARCH_NAME})&lt;BR /&gt;&lt;BR /&gt;Notice that 'grep' can count using the '-c' option and that 'grep' can read a file directly.  Thus, both the 'cat' (to do I/O) and the 'wc' to count can be eliminated.&lt;BR /&gt;&lt;BR /&gt;In optimizing, look for extra processes in pipelines that can be eliminated.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Feb 2010 15:10:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586466#M679397</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-02-18T15:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586467#M679398</link>
      <description>Thanks, James!!&lt;BR /&gt;&lt;BR /&gt;Do you mean that I need to replace the line with your provided line?&lt;BR /&gt;&lt;BR /&gt;And, Please let me know what else can be modifed in order to reduce the usage of CPU, what do you mean by pipeline here? - Through some light directly on to it to make me understand very clear.&lt;BR /&gt;&lt;BR /&gt;Actually speaking, I am new to scripting and this is an existing script in my environemnt.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Gobinathan.S</description>
      <pubDate>Thu, 18 Feb 2010 15:33:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586467#M679398</guid>
      <dc:creator>Gobinathan</dc:creator>
      <dc:date>2010-02-18T15:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586468#M679399</link>
      <description>You may want to be careful when modifying this script.&lt;BR /&gt;&lt;BR /&gt;All the calls to the "opcmon" program leads me to believe that this script could be part of the Openview Operations product.  &lt;BR /&gt;&lt;BR /&gt;Trying to do too much with this script **could** cause problems with Openview Operations and its ability to monitor your system.&lt;BR /&gt;&lt;BR /&gt;What is the actual script name?</description>
      <pubDate>Thu, 18 Feb 2010 15:43:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586468#M679399</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2010-02-18T15:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586469#M679400</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; It's a small script only but contains so many if then loops&lt;BR /&gt;&lt;BR /&gt;Based on how many files you match, yes.  The 'if' evaluations aren't going to be very costly though.&lt;BR /&gt;&lt;BR /&gt;Another side note is that you call the system for the date and time twice.  This isn't a good idea since you can end up with data for different minutes, hours or even days.&lt;BR /&gt;&lt;BR /&gt;It would be better to do something like:&lt;BR /&gt;&lt;BR /&gt;# DATE=$(date +%H%M)&lt;BR /&gt;# value=$(echo ${DATE}|cut -c1-2)&lt;BR /&gt;# extension=$(echo ${DATE}|cut -c3-4)&lt;BR /&gt;&lt;BR /&gt;Notice again, that instead of using the archaic backticks for command evaluation, I used the POSIX '$(...)' form.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 18 Feb 2010 15:43:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586469#M679400</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-02-18T15:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586470#M679401</link>
      <description>Also, Is it possible to use the statement as below or suggest me the way to go in a good way&lt;BR /&gt;&lt;BR /&gt;Instead of using like:&lt;BR /&gt;&lt;BR /&gt;case $4 in  "Too many open files")  &lt;BR /&gt;STATUS=0       &lt;BR /&gt;       if [ $value -eq 11 ] || [ $value -eq 15 ]               then &lt;BR /&gt;              if [ $CMD_OUTPUT -gt 500 ]&lt;BR /&gt;                then&lt;BR /&gt;                   if [ $extension -lt 12 ]&lt;BR /&gt;                     then&lt;BR /&gt;                       STATUS=1 &lt;BR /&gt;                   fi&lt;BR /&gt;              fi&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;Can I use:&lt;BR /&gt;&lt;BR /&gt;if (( ( $value -eq 11  || $value -eq 15 ) &amp;amp;&amp;amp; ( $CMD_OUTPUT -gt 500 ) &amp;amp;&amp;amp; ( $extension -lt 12 ) )) then;&lt;BR /&gt;STATUS=1&lt;BR /&gt;&lt;BR /&gt;Is this a good way of doing it, will it optimize my requirement.</description>
      <pubDate>Thu, 18 Feb 2010 15:44:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586470#M679401</guid>
      <dc:creator>Gobinathan</dc:creator>
      <dc:date>2010-02-18T15:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586471#M679402</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Do you mean that I need to replace the line &lt;BR /&gt;with your provided line?&lt;BR /&gt;&lt;BR /&gt;Yes.  The line in question when replaced, eliminates a 'cat' and a 'wc' process.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; And, Please let me know what else can be modifed in order to reduce the usage of CPU, what do you mean by pipeline here? &lt;BR /&gt;&lt;BR /&gt;Again, using:&lt;BR /&gt;&lt;BR /&gt;# CMD_OUTPUT=`cat $SEARCH_NAME | grep -i "$4" | wc -l`&lt;BR /&gt;&lt;BR /&gt;...versus:&lt;BR /&gt;&lt;BR /&gt;# CMD_OUTPUT=$(grep -c -i "$4" ${SEARCH_NAME})&lt;BR /&gt;&lt;BR /&gt;In the first case, a 'cat' process runs to read a file.  That process then writes what it reads to a new process --- the 'grep'.  This reads what appears in the pipe and writes whatever matches to yet another process --- 'wc' to count the matches.  The 'wc' has to read the pipe's output too.&lt;BR /&gt;&lt;BR /&gt;In the second case, I let the 'grep' read the input file; match and count what you want; and output (write) one result.&lt;BR /&gt;&lt;BR /&gt;A pipeline is fundamental to UNIX processing, but every command in the pipe has to be spawned (created as a new process).  Process creation is expensive.  In the examples above, too, you repeat I/O reads and writes needlessly.  This probably slows down the whole execution more than just creating the processes to do it.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Feb 2010 15:50:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586471#M679402</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-02-18T15:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586472#M679403</link>
      <description>Could you pls answer my previous question?&lt;BR /&gt;&lt;BR /&gt;and, pls give me clarity on pipeline fundamental and explain the lines and what i can modify it?&lt;BR /&gt;&lt;BR /&gt;That would be better from next time i can consider while writing the script.</description>
      <pubDate>Thu, 18 Feb 2010 15:59:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586472#M679403</guid>
      <dc:creator>Gobinathan</dc:creator>
      <dc:date>2010-02-18T15:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586473#M679404</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Can I use:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; if (( ( $value -eq 11 || $value -eq 15 ) &amp;amp;&amp;amp; ( $CMD_OUTPUT -gt 500 ) &amp;amp;&amp;amp; ( $extension -lt 12 ) )) then;&lt;BR /&gt;&lt;BR /&gt;I would do:&lt;BR /&gt;&lt;BR /&gt;# if [ \( $value -eq 11 -o $value -eq 15 \) -a \( $CMD_OUTPUT -gt 500 -a $extension -lt 12 \) ]; then&lt;BR /&gt;&lt;BR /&gt;...see the manpages for 'test'.&lt;BR /&gt;&lt;BR /&gt;It is good defensive shell coding to enclose your variables in double quotes when testing them.  That way, empty (unassigned) variables don't lead to syntax errors.&lt;BR /&gt;&lt;BR /&gt;It is also good practice to do variable evaulation with curly braces.  In all:&lt;BR /&gt;&lt;BR /&gt;# if [ \( "${value}" -eq 11 -o "${value}" -eq 15 \) -a \( "${CMD_OUTPUT}" -gt 500 -a "${extension}" -lt 12 \) ]; then&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Feb 2010 16:03:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586473#M679404</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-02-18T16:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586474#M679405</link>
      <description>Thanks and proud to interacting with Scripting master!!&lt;BR /&gt;&lt;BR /&gt;"A pipeline is fundamental to UNIX processing, but every command in the pipe has to be spawned (created as a new process). Process creation is expensive. In the examples above, too, you repeat I/O reads and writes needlessly. This probably slows down the whole execution more than just creating the processes to do it."&lt;BR /&gt;&lt;BR /&gt;Is it possible for you to  give me more clarity on this and give me a solution how to modify this script on this pipeline issue? So that I can take it forward from my next script....&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Gobinathan.S</description>
      <pubDate>Thu, 18 Feb 2010 16:11:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586474#M679405</guid>
      <dc:creator>Gobinathan</dc:creator>
      <dc:date>2010-02-18T16:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586475#M679406</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Is it possible for you to give me more clarity on this and give me a solution how to modify this script on this pipeline issue? &lt;BR /&gt;&lt;BR /&gt;I did.  I have, and I don't know how else to explain it.  Compare the lines of code that I showed you that set the value of 'CMD_OUTPUT'&lt;BR /&gt;&lt;BR /&gt;Yours has a pipeline involving a 'cat', a 'grep' and a 'wc'.  I removed the pipe altogether in this case.  Pipes are very important and eliminate the use of temporary files that would otherwise be written and read.  My point was to let a process do as much work as it is capable without piping its output to another process when possible.  In the case of 'grep' it can read input; match; and output the matches or the count of the matches without the need to invoke another process.&lt;BR /&gt;&lt;BR /&gt;Your scripting skills will grow with practice and by studying other people's code.  A very good site containing lots of scripts and techniques is:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.shelldorado.com/" target="_blank"&gt;http://www.shelldorado.com/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy the journey!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 18 Feb 2010 16:22:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586475#M679406</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-02-18T16:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586476#M679407</link>
      <description>Thanks for all your prompt reply!!&lt;BR /&gt;&lt;BR /&gt;You can expect many more questions in future!! :-)&lt;BR /&gt;&lt;BR /&gt;Also, I'll start learn from my side!!&lt;BR /&gt;&lt;BR /&gt;One last question, As we discussed by changing the if then statement as,&lt;BR /&gt;&lt;BR /&gt;# if [ \( "${value}" -eq 11 -o "${value}" -eq 15 \) -a \( "${CMD_OUTPUT}" -gt 500 -a "${extension}" -lt 12 \) ]; then&lt;BR /&gt;&lt;BR /&gt;Will it improve performance of Script? (Instead of using the old one which I'm having as below)&lt;BR /&gt;&lt;BR /&gt;if [ $value -eq 11 ] || [ $value -eq 15 ] then &lt;BR /&gt;if [ $CMD_OUTPUT -gt 500 ]&lt;BR /&gt;then&lt;BR /&gt;if [ $extension -lt 12 ]&lt;BR /&gt;then&lt;BR /&gt;STATUS=1 &lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Gobinathan.S&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Feb 2010 16:27:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586476#M679407</guid>
      <dc:creator>Gobinathan</dc:creator>
      <dc:date>2010-02-18T16:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586477#M679408</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; One last question, As we discussed by changing the if then statement...Will it improve performance of Script? (Instead of using the old one which I'm having as below)&lt;BR /&gt;&lt;BR /&gt;No, it really won't change the performance you see, but it makes the logic of your script a bit easier to understand.&lt;BR /&gt;&lt;BR /&gt;Good code creates a balance between readability/maintainability and tricks to be fast.  Remember, its the poor human that has to maintain the code, and that human being may not be the original writer!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 18 Feb 2010 16:35:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586477#M679408</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-02-18T16:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586478#M679409</link>
      <description>Hi Patrick,&lt;BR /&gt;&lt;BR /&gt;I did not answer for your question, Sorry for that.&lt;BR /&gt;&lt;BR /&gt;What is the actual script name?&lt;BR /&gt;&lt;BR /&gt;testpattern.sh&lt;BR /&gt;&lt;BR /&gt;Yes, I'm using this for Openview monitoring template only. If any suggestions, Pls add to it.</description>
      <pubDate>Thu, 18 Feb 2010 16:49:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586478#M679409</guid>
      <dc:creator>Gobinathan</dc:creator>
      <dc:date>2010-02-18T16:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586479#M679410</link>
      <description>&amp;gt;let me know what else can be modified in order to reduce the usage of CPU, what do you mean by pipeline here?&lt;BR /&gt;&lt;BR /&gt;What OS version and architecture are you using?  Do you have glance?&lt;BR /&gt;What does top(1) show as taking time?  If not your shell, you probably can't do much.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;if (( ( $value -eq 11 || $value -eq 15 ) &amp;amp;&amp;amp; ( $CMD_OUTPUT -gt 500 ) &amp;amp;&amp;amp; ( $extension -lt 12 ) )) then&lt;BR /&gt;&lt;BR /&gt;You should toss the goofy shell operators and go with C:&lt;BR /&gt;if (( (value == 11 || value == 15) &amp;amp;&amp;amp; CMD_OUTPUT &amp;gt; 500 &amp;amp;&amp;amp; extension &amp;lt; 12 )); then&lt;BR /&gt;&lt;BR /&gt;This won't help much on performance.</description>
      <pubDate>Thu, 18 Feb 2010 17:12:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586479#M679410</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-02-18T17:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586480#M679411</link>
      <description>&lt;BR /&gt;OS/HW: HP-UX B.11.31 U ia64&lt;BR /&gt;Also, some cases we need to run on RHEL 4.0&lt;BR /&gt;&lt;BR /&gt;Do you mean to use C program?&lt;BR /&gt;&lt;BR /&gt;We are limited to Shell and Perl as the product that supports only these scripts.&lt;BR /&gt;&lt;BR /&gt;Is it possible to use C operators as you mentioned in Shell?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Gobinathan.S&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Feb 2010 17:38:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586480#M679411</guid>
      <dc:creator>Gobinathan</dc:creator>
      <dc:date>2010-02-18T17:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586481#M679412</link>
      <description>&amp;gt;Do you mean to use C program?&lt;BR /&gt;&amp;gt;Is it possible to use C operators as you mentioned in Shell?&lt;BR /&gt;&lt;BR /&gt;No, just use C operators inside shell (( )) arithmetic expressions.  Exactly as I had.</description>
      <pubDate>Thu, 18 Feb 2010 17:42:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586481#M679412</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-02-18T17:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586482#M679413</link>
      <description>&lt;!--!*#--&gt;Hello Gobinathan,&lt;BR /&gt;&lt;BR /&gt;My advice are the same as given above and additionally the following :&lt;BR /&gt;&lt;BR /&gt;- suppress variable assignations as much as possible (although it compromises readability);&lt;BR /&gt;&lt;BR /&gt;- reduce calls to echo or print (intermediate variables might be displayed in one shot);&lt;BR /&gt;&lt;BR /&gt;- reduce execution of external commands (date might be executed only once and cut not used);&lt;BR /&gt;&lt;BR /&gt;- use grep -F which should be, in theory, faster than grep (but this is probably not true anymore)&lt;BR /&gt;&lt;BR /&gt;This is the result :&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset STATUS=0&lt;BR /&gt;&lt;BR /&gt;integer value extension&lt;BR /&gt;date +'%H %M' | read value extension&lt;BR /&gt;&lt;BR /&gt;integer CMD_OUTPUT=$( grep -Fci $4 $2/$3 )&lt;BR /&gt;&lt;BR /&gt;print "$value\n$extension\n$CMD_OUTPUT"&lt;BR /&gt;&lt;BR /&gt;case $4 in &lt;BR /&gt;&lt;BR /&gt; "Too many open files")&lt;BR /&gt;  (( ( value == 11 || value == 15 ) &amp;amp;&amp;amp; CMD_OUTPUT &amp;gt; 500 &amp;amp;&amp;amp; extension &amp;lt; 12 )) \&lt;BR /&gt;   &amp;amp;&amp;amp; STATUS=1&lt;BR /&gt; ;;&lt;BR /&gt;&lt;BR /&gt; "ERR_REASON:255" |\&lt;BR /&gt; "ERR_REASON:20")&lt;BR /&gt;  (( CMD_OUTPUT &amp;gt; 500 )) \&lt;BR /&gt;   &amp;amp;&amp;amp; STATUS=1&lt;BR /&gt; ;;&lt;BR /&gt;&lt;BR /&gt; "ERR_REASON:8#")&lt;BR /&gt;  (( CMD_OUTPUT &amp;gt; 10 )) \&lt;BR /&gt;   &amp;amp;&amp;amp; STATUS=1&lt;BR /&gt; ;;&lt;BR /&gt;&lt;BR /&gt; "ERR_REASON:88")&lt;BR /&gt;  (( CMD_OUTPUT &amp;gt; 100 )) \&lt;BR /&gt;   &amp;amp;&amp;amp; STATUS=1&lt;BR /&gt; ;;&lt;BR /&gt;&lt;BR /&gt; "ERR_REASON:10" |\&lt;BR /&gt; "ERR_REASON:11" |\&lt;BR /&gt; "ERR_REASON:2"  |\&lt;BR /&gt; "ERR_REASON:3")&lt;BR /&gt;  (( ( value == 23 &amp;amp;&amp;amp; extension &amp;lt; 55 ) &amp;amp;&amp;amp; CMD_OUTPUT &amp;gt; 1 )) \&lt;BR /&gt;   &amp;amp;&amp;amp; STATUS=1&lt;BR /&gt; ;;&lt;BR /&gt;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;print "/opt/OV/bin/OpC/opcmon $1=$STATUS -option PROCNAME=$CMD_OUTPUT"&lt;BR /&gt;/opt/OV/bin/OpC/opcmon $1=$STATUS -option PROCNAME=$CMD_OUTPUT&lt;BR /&gt;&lt;BR /&gt;I copied out the actions that were done in every case conditions after esac.&lt;BR /&gt;&lt;BR /&gt;What might improve the speed of your script is also to order the case conditions so that the most likely to be found comes first and the least comes last.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Jean-Philippe&lt;BR /&gt;</description>
      <pubDate>Sun, 21 Feb 2010 02:50:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586482#M679413</guid>
      <dc:creator>Jean-Philippe Henry</dc:creator>
      <dc:date>2010-02-21T02:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization/Speed up help needed on the script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586483#M679414</link>
      <description>&lt;!--!*#--&gt;Hello again,&lt;BR /&gt;&lt;BR /&gt;Sorry, I forgot to surround $4 with double quotes in the grep command line.&lt;BR /&gt;&lt;BR /&gt;Please read:&lt;BR /&gt;&lt;BR /&gt;integer CMD_OUTPUT=$( grep -Fci "$4" $2/$3 )&lt;BR /&gt;&lt;BR /&gt;instead of:&lt;BR /&gt;&lt;BR /&gt;integer CMD_OUTPUT=$( grep -Fci $4 $2/$3 )&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Jean-Philippe</description>
      <pubDate>Sun, 21 Feb 2010 22:20:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/optimization-speed-up-help-needed-on-the-script/m-p/4586483#M679414</guid>
      <dc:creator>Jean-Philippe Henry</dc:creator>
      <dc:date>2010-02-21T22:20:07Z</dc:date>
    </item>
  </channel>
</rss>

