<?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: scripting advice in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481777#M18294</link>
    <description>Guys&lt;BR /&gt;&lt;BR /&gt;- looks good to me&lt;BR /&gt;&lt;BR /&gt;Thanks for your help&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;</description>
    <pubDate>Thu, 11 Jan 2001 17:38:13 GMT</pubDate>
    <dc:creator>Steve Massey_1</dc:creator>
    <dc:date>2001-01-11T17:38:13Z</dc:date>
    <item>
      <title>scripting advice</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481772#M18289</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I am developing an interactive monitor script. It works fine, but I am looking for a more subtle use of awk/sed in the disp() function.&lt;BR /&gt;I am hoping to replace the amount of greping being done.&lt;BR /&gt;Is there a better way ??&lt;BR /&gt;&lt;BR /&gt;Thanks for any help&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Thu, 11 Jan 2001 14:41:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481772#M18289</guid>
      <dc:creator>Steve Massey_1</dc:creator>
      <dc:date>2001-01-11T14:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: scripting advice</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481773#M18290</link>
      <description>Hi Steve,&lt;BR /&gt;&lt;BR /&gt;You could combine the 2 first 'grep' into one:&lt;BR /&gt;&lt;BR /&gt;grep "LV Name" /tmp/vgout | awk -F/ '{print $3,$4}' | read vgp lvgp&lt;BR /&gt;&lt;BR /&gt;My 2 cents,&lt;BR /&gt;&lt;BR /&gt;Dan</description>
      <pubDate>Thu, 11 Jan 2001 14:57:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481773#M18290</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-01-11T14:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: scripting advice</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481774#M18291</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;Another line, reading:&lt;BR /&gt;&lt;BR /&gt;echo $vgp $lvgp $mirr1 $stat1 | awk '{printf "   %-10s  %-10s  %-10s  %-10s\n",$1, $2, $3, $4}'&lt;BR /&gt;&lt;BR /&gt;could be replaced with:&lt;BR /&gt;&lt;BR /&gt;printf "   %-10s  %-10s  %-10s  %-10s\n" $vgp $lvgp $mirr1 $stat1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;That makes 4 cents !! ;7)&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Jan 2001 15:04:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481774#M18291</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-01-11T15:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: scripting advice</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481775#M18292</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You could use the 'line search' feature of 'awk' to find all the strings you're looking for in displ. Instead of running 4 'grep' and 4 'awk' programs, you could combine this in one simple 'awk' outputting 4 values that is piped into a read statement.&lt;BR /&gt;&lt;BR /&gt;6 cents, still far from a full buck !&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Jan 2001 15:10:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481775#M18292</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-01-11T15:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: scripting advice</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481776#M18293</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;here my version of the function displ()&lt;BR /&gt;&lt;BR /&gt;displ()&lt;BR /&gt;{&lt;BR /&gt;/usr/sbin/lvdisplay -v $b 2&amp;gt;/dev/null | awk '{&lt;BR /&gt;if($0 ~ "LV Name")&lt;BR /&gt;{&lt;BR /&gt;  split($0, a, "/");&lt;BR /&gt;  vgp=a[3];&lt;BR /&gt;  lvgp=a[4];&lt;BR /&gt;}&lt;BR /&gt;if($0 ~ "LV Status")&lt;BR /&gt;{&lt;BR /&gt;  if($3 == "available/syncd")&lt;BR /&gt;    status="Good";&lt;BR /&gt;  else&lt;BR /&gt;    status="Bad";&lt;BR /&gt;}&lt;BR /&gt;if($0 ~ "Mirror copies")&lt;BR /&gt;{&lt;BR /&gt;  if($3 == "1")&lt;BR /&gt;    mirror="Yes";&lt;BR /&gt;  else&lt;BR /&gt;    mirror="No";&lt;BR /&gt;  printf("   %-10s  %-10s  %-10s  %-10s\n", vgp, lvgp, mirror, status);&lt;BR /&gt;}&lt;BR /&gt;}'&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 11 Jan 2001 15:23:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481776#M18293</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2001-01-11T15:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: scripting advice</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481777#M18294</link>
      <description>Guys&lt;BR /&gt;&lt;BR /&gt;- looks good to me&lt;BR /&gt;&lt;BR /&gt;Thanks for your help&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Jan 2001 17:38:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481777#M18294</guid>
      <dc:creator>Steve Massey_1</dc:creator>
      <dc:date>2001-01-11T17:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: scripting advice</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481778#M18295</link>
      <description>As Andreas so nicely shows, awk can be used to do many tasks.  Awk understands regular expressions, line and body searches, and prints very nicely with "printf".&lt;BR /&gt;Any time your are taking output from grep and piping to awk, the grep can be omitted.  (Maybe a rare case where it can not, but I have never seen any...)&lt;BR /&gt;I.E.&lt;BR /&gt;ps -ef|grep inetd|awk '{print $2} &lt;BR /&gt;can be replaced with&lt;BR /&gt;ps -ef|awk '/"inetd"/ {print $0}'&lt;BR /&gt;NOTE:  Certain shells will give you the awk process as well.....But I think you get the point....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Shannon&lt;BR /&gt;&lt;BR /&gt;PS.  O'Reilly and Associates puts out a great book on sed and awk.  If you dont have it, it is definately worth the $30 bucks or so!</description>
      <pubDate>Fri, 12 Jan 2001 15:00:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-advice/m-p/2481778#M18295</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2001-01-12T15:00:51Z</dc:date>
    </item>
  </channel>
</rss>

