<?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: output redirection and wc in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/output-redirection-and-wc/m-p/4697310#M659097</link>
    <description>thanks Steve, lot of info, good learning...&lt;BR /&gt;i found one small temporary (TEMP) idea, let me know this is good or not...here it is:&lt;BR /&gt;&lt;BR /&gt;root@OVO&amp;gt; more agent-redeployment.sh&lt;BR /&gt;COUNT=1&lt;BR /&gt;for NODE in $(&lt;NODES-HPDEV&gt;&lt;/NODES-HPDEV&gt; do&lt;BR /&gt;&lt;BR /&gt;echo date is `date` &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;echo Node Name - $NODE &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;echo Server Count is ${COUNT} &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;ovdeploy -cmd "opctemplate -list" -node $NODE &amp;gt;TEMPFILE 2&amp;gt;&amp;gt;HPDev.Policies.error&lt;BR /&gt;cat TEMPFILE &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;wc TEMPFILE &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;sleep 10&lt;BR /&gt;COUNT=${COUNT} + 1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;1. this TEMPFILE idea is fine or not?&lt;BR /&gt;2. this COUNT=${COUNT} + 1 not works. like C++, do we have COUNT++ in shell scripting?&lt;BR /&gt;</description>
    <pubDate>Sat, 09 Oct 2010 02:18:44 GMT</pubDate>
    <dc:creator>sekar sundaram</dc:creator>
    <dc:date>2010-10-09T02:18:44Z</dc:date>
    <item>
      <title>output redirection and wc</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/output-redirection-and-wc/m-p/4697308#M659095</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;a simple question...&lt;BR /&gt;for i in NODE `cat nodeslist`&lt;BR /&gt;do&lt;BR /&gt;echo `date` &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;eecho Node Name - $NODE &amp;gt;&amp;gt; HPDev.policies&lt;BR /&gt;ovdeploy -cmd "opctemplate -list" -node $NODE &amp;gt;&amp;gt;HPDev.policies 2&amp;gt;&amp;gt;HPDev.Policies.error | wc &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;i am running a command to get list of policies on a node and sending it to a file. also the count of policies i would like to update.&lt;BR /&gt;but this "wc" does not work.&lt;BR /&gt;this above "wc" updates only 0 0 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 09 Oct 2010 01:33:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/output-redirection-and-wc/m-p/4697308#M659095</guid>
      <dc:creator>sekar sundaram</dc:creator>
      <dc:date>2010-10-09T01:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: output redirection and wc</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/output-redirection-and-wc/m-p/4697309#M659096</link>
      <description>&lt;!--!*#--&gt;&amp;gt; [...] but this "wc" does not work.  [...]&lt;BR /&gt;&lt;BR /&gt;It counts what it sees, but what does it see?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; [...] &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;&amp;gt; [...] 2&amp;gt;&amp;gt;HPDev.Policies.error&lt;BR /&gt;&amp;gt; [...] | wc [...]&lt;BR /&gt;&lt;BR /&gt;You seem to be sending stdout to one file,&lt;BR /&gt;and stderr to another file.  Then you pipe&lt;BR /&gt;what's left into "wc", but what's left?&lt;BR /&gt;Everything has already been redirected to&lt;BR /&gt;some file or other.&lt;BR /&gt;&lt;BR /&gt;Consider this simpler (all-shell) example:&lt;BR /&gt;&lt;BR /&gt;dyi # ( echo stdout ; echo stderr 1&amp;gt;&amp;amp;2 )&lt;BR /&gt;stdout&lt;BR /&gt;stderr&lt;BR /&gt;&lt;BR /&gt;Now, redirect stdout to "so", and stderr to&lt;BR /&gt;"se" (and look at those files):&lt;BR /&gt;&lt;BR /&gt;dyi # ( echo stdout ; echo stderr 1&amp;gt;&amp;amp;2 ) &amp;gt; so 2&amp;gt; se&lt;BR /&gt;dyi # cat so&lt;BR /&gt;stdout&lt;BR /&gt;dyi # cat se&lt;BR /&gt;stderr&lt;BR /&gt;&lt;BR /&gt;The files got their data, but there's nothing&lt;BR /&gt;left to be sent to the terminal (or into a&lt;BR /&gt;pipeline).  Piping nothing into "wc" will&lt;BR /&gt;give you "0 0 0".&lt;BR /&gt;&lt;BR /&gt;You could use "tee" to copy stdout into a&lt;BR /&gt;file, while passing it along in stdout.  For&lt;BR /&gt;example:&lt;BR /&gt;&lt;BR /&gt;dyi # ( echo stdout ; echo stderr 1&amp;gt;&amp;amp;2 ) 2&amp;gt; se | tee so&lt;BR /&gt;stdout&lt;BR /&gt;dyi # cat so&lt;BR /&gt;stdout&lt;BR /&gt;dyi # cat se&lt;BR /&gt;stderr&lt;BR /&gt;&lt;BR /&gt;The files still get their data, but stdout&lt;BR /&gt;(here, "stdout") continues along to the&lt;BR /&gt;terminal, too.  _This_ can be piped into&lt;BR /&gt;another program (like "wc"):&lt;BR /&gt;&lt;BR /&gt;dyi # ( echo stdout ; echo stderr 1&amp;gt;&amp;amp;2 ) 2&amp;gt; se | tee so | wc&lt;BR /&gt;1 1 7&lt;BR /&gt;&lt;BR /&gt;      man tee&lt;BR /&gt;&lt;BR /&gt;Look for "-a", which you'll probably want to&lt;BR /&gt;use (in place of "&amp;gt;&amp;gt;").</description>
      <pubDate>Sat, 09 Oct 2010 02:11:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/output-redirection-and-wc/m-p/4697309#M659096</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2010-10-09T02:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: output redirection and wc</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/output-redirection-and-wc/m-p/4697310#M659097</link>
      <description>thanks Steve, lot of info, good learning...&lt;BR /&gt;i found one small temporary (TEMP) idea, let me know this is good or not...here it is:&lt;BR /&gt;&lt;BR /&gt;root@OVO&amp;gt; more agent-redeployment.sh&lt;BR /&gt;COUNT=1&lt;BR /&gt;for NODE in $(&lt;NODES-HPDEV&gt;&lt;/NODES-HPDEV&gt; do&lt;BR /&gt;&lt;BR /&gt;echo date is `date` &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;echo Node Name - $NODE &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;echo Server Count is ${COUNT} &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;ovdeploy -cmd "opctemplate -list" -node $NODE &amp;gt;TEMPFILE 2&amp;gt;&amp;gt;HPDev.Policies.error&lt;BR /&gt;cat TEMPFILE &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;wc TEMPFILE &amp;gt;&amp;gt;HPDev.policies&lt;BR /&gt;sleep 10&lt;BR /&gt;COUNT=${COUNT} + 1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;1. this TEMPFILE idea is fine or not?&lt;BR /&gt;2. this COUNT=${COUNT} + 1 not works. like C++, do we have COUNT++ in shell scripting?&lt;BR /&gt;</description>
      <pubDate>Sat, 09 Oct 2010 02:18:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/output-redirection-and-wc/m-p/4697310#M659097</guid>
      <dc:creator>sekar sundaram</dc:creator>
      <dc:date>2010-10-09T02:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: output redirection and wc</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/output-redirection-and-wc/m-p/4697311#M659098</link>
      <description>&amp;gt;1. this TEMPFILE idea is fine or not?&lt;BR /&gt;&lt;BR /&gt;Yes it will work.  Make sure you clean it up and not have more than one use of the script at a time.  Otherwise you need to make it unique by adding .$$&lt;BR /&gt;&lt;BR /&gt;&amp;gt;2. this COUNT=${COUNT} + 1 not works. like C++, do we have COUNT++ in shell scripting?&lt;BR /&gt;&lt;BR /&gt;No, a real shell says ++/-- are not supported.  Use:&lt;BR /&gt;(( count += 1 ))</description>
      <pubDate>Sat, 09 Oct 2010 02:29:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/output-redirection-and-wc/m-p/4697311#M659098</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-10-09T02:29:07Z</dc:date>
    </item>
  </channel>
</rss>

