<?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: Fun awk script. Looking to a possible improvement in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655792#M677216</link>
    <description>in shell&lt;BR /&gt;set -- $(ioscan -kfnC fc )&lt;BR /&gt;while [ $# != 0 ]&lt;BR /&gt;do&lt;BR /&gt; if [ ${1#/dev/} != $1 ]&lt;BR /&gt; then&lt;BR /&gt;   eval "$( fcmsutil  $1| tr -d ' -') echo \&lt;BR /&gt; \$HardwarePathis \&lt;BR /&gt; \$N_PortNodeWorldWideName \&lt;BR /&gt; \$N_PortPortWorldWideName \&lt;BR /&gt; \$SwitchPortWorldWideName \&lt;BR /&gt; \$SwitchNodeWorldWideName"&lt;BR /&gt; fi&lt;BR /&gt; shift&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Sun, 04 Jul 2010 21:00:15 GMT</pubDate>
    <dc:creator>Laurent Menase</dc:creator>
    <dc:date>2010-07-04T21:00:15Z</dc:date>
    <item>
      <title>Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655780#M677204</link>
      <description>I had a need to display some hardware information to update some documentation.&lt;BR /&gt;&lt;BR /&gt;So I created this: &lt;A href="http://www.hpux.ws/?p=149" target="_blank"&gt;http://www.hpux.ws/?p=149&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;ioscan -fnkCfc | awk ‘/fcd/ {getline;fcd=$NF;print fcd,$2 }’ | while read -r fdev&lt;BR /&gt;do&lt;BR /&gt;  fcmsutil $fdev | awk ‘/Hardware / {print $5}’&lt;BR /&gt;  fcmsutil $fdev | awk ‘/World / { print $7}’&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I'm pushing myself to be more awkful and am wondering how I would go about combining the two fcmsutil statements and running fcmsutil only once to save on cpu usage. Not that I should care on a superdome, but I need to do this for work and I find this extremely fun to do.&lt;BR /&gt;&lt;BR /&gt;What I'm thinking is a little awk for loop to roll through and getline and then select the ouput I want.&lt;BR /&gt;&lt;BR /&gt;My awk guru is out of the office today, so I will first do the job and actually update the dcoumentation and then continue to hack around with the awk.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 01 Jul 2010 15:07:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655780#M677204</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2010-07-01T15:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655781#M677205</link>
      <description>&lt;!--!*#--&gt;Hi Sep:&lt;BR /&gt;&lt;BR /&gt;# cat ./ascript&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;ioscan -kfnC fc | awk '/fcd/ {getline;fcd=$NF;print fcd,$2}' | while read -r fdev&lt;BR /&gt;do&lt;BR /&gt;    fcmsutil ${fdev} | awk '/Hardware / {print $5};/World / { print $7}'&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;...that is, simply specify your multiple pattern matches and their statements as shown.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 01 Jul 2010 15:22:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655781#M677205</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-07-01T15:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655782#M677206</link>
      <description>Didn't realize it was that simple.&lt;BR /&gt;&lt;BR /&gt;Happy to put you 10 points closer to me JRF, you are truly the more gifted admin.&lt;BR /&gt;&lt;BR /&gt;To earn another 10, I was thinking I wanted to format the data&lt;BR /&gt;&lt;BR /&gt;PATH  WWN node WWN port WWN port WWN node &lt;BR /&gt;&lt;BR /&gt;I am updating the blog after I test and making an attempt to format the output.&lt;BR /&gt;&lt;BR /&gt;The formatting makes it easier to create live documanation.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 01 Jul 2010 15:28:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655782#M677206</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2010-07-01T15:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655783#M677207</link>
      <description>&lt;!--!*#--&gt;Working on something here.&lt;BR /&gt;&lt;BR /&gt;ioscan -kfnC fc | awk '/fcd/ {getline;fcd=$NF;print fcd,$2}' | while read -r fde&lt;BR /&gt;v&lt;BR /&gt;do&lt;BR /&gt;    fcmsutil ${fdev} | awk '/Hardware / {print $5};/World / { print $7}' | awk '&lt;BR /&gt;{printf "%s %s %s %s %s\n",$1, $2, $3, $4, $5}'&lt;BR /&gt;&lt;BR /&gt;The line break is not working out here.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 01 Jul 2010 15:38:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655783#M677207</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2010-07-01T15:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655784#M677208</link>
      <description>&lt;!--!*#--&gt;Hi (again) SEP:&lt;BR /&gt;&lt;BR /&gt;Perhaps formatted like this:&lt;BR /&gt;&lt;BR /&gt;# ./ascript&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;ioscan -kfnC fc | awk '/fcd/ {getline;fcd=$NF;print fcd,$2}' | while read -r fdev&lt;BR /&gt;do&lt;BR /&gt;    fcmsutil ${fdev} | \&lt;BR /&gt;        awk '/Hardware Path/ {PATH=$5};&lt;BR /&gt;             /N_Port Node/  {NNODE=$7};&lt;BR /&gt;             /N_Port Port/  {NPORT=$7};&lt;BR /&gt;             /Switch Port/  {SPORT=$7};&lt;BR /&gt;             /Switch Node/  {SNODE=$7};&lt;BR /&gt;            END{print PATH, NNODE, NPORT, SPORT, SNODE}&lt;BR /&gt;            '&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 01 Jul 2010 15:53:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655784#M677208</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-07-01T15:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655785#M677209</link>
      <description>Thanks JRF.&lt;BR /&gt;&lt;BR /&gt;I almost had it.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 01 Jul 2010 16:00:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655785#M677209</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2010-07-01T16:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655786#M677210</link>
      <description>fcmsutil $fdev | awk â  /Hardware / {print $5;next}&lt;BR /&gt;/World/{ print $7;next}â  &lt;BR /&gt;  &lt;BR /&gt;HTH</description>
      <pubDate>Thu, 01 Jul 2010 16:18:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655786#M677210</guid>
      <dc:creator>Victor Fridyev</dc:creator>
      <dc:date>2010-07-01T16:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655787#M677211</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;ITRC or your browser or notepad tool ate your output Victor.&lt;BR /&gt;&lt;BR /&gt;fcmsutil $fdev | awk '/Hardware / {print $5;next}&lt;BR /&gt;/World /{ print $7;next}'&lt;BR /&gt;&lt;BR /&gt;That is how I interpret your entry.&lt;BR /&gt;&lt;BR /&gt;I'm posting 8 points to the response because you were a great boss.&lt;BR /&gt;&lt;BR /&gt;This issue is resolved, but I'm totally willing to see and reward other approaches.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 01 Jul 2010 18:23:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655787#M677211</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2010-07-01T18:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655788#M677212</link>
      <description>You interpret it correctly. Please, without points.</description>
      <pubDate>Thu, 01 Jul 2010 19:04:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655788#M677212</guid>
      <dc:creator>Victor Fridyev</dc:creator>
      <dc:date>2010-07-01T19:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655789#M677213</link>
      <description>&lt;!--!*#--&gt;Hi (again) SEP:&lt;BR /&gt;&lt;BR /&gt;As Victor showed, we should really stop matching as soon as a pattern is found.  Adding 'next' to the action statement for each pattern is one way.  Another is to write a cascading 'if/else':&lt;BR /&gt;&lt;BR /&gt;# cat ./ascript&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;ioscan -kfnC fc | awk '/fcd/ {getline;fcd=$NF;print fcd,$2}' | while read -r fdev&lt;BR /&gt;do&lt;BR /&gt;    fcmsutil ${fdev} | \&lt;BR /&gt;        awk '&lt;BR /&gt;            {if (/Hardware Path/) {&lt;BR /&gt;                PATH=$5&lt;BR /&gt;            } else if (/N_Port Node/) {&lt;BR /&gt;                NNODE=$7&lt;BR /&gt;            } else if (/N_Port Port/) {&lt;BR /&gt;                NPORT=$7&lt;BR /&gt;            } else if (/Switch Port/) {&lt;BR /&gt;                SPORT=$7&lt;BR /&gt;            } else if (/Switch Node/) {&lt;BR /&gt;                SNODE=$7&lt;BR /&gt;            }&lt;BR /&gt;            }&lt;BR /&gt;            END{print PATH, NNODE, NPORT, SPORT, SNODE}&lt;BR /&gt;            '&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 02 Jul 2010 19:31:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655789#M677213</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-07-02T19:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655790#M677214</link>
      <description>&lt;!--!*#--&gt;Hello Steven,&lt;BR /&gt;&lt;BR /&gt;Here is my fun - I hope - proposal:&lt;BR /&gt;&lt;BR /&gt;ioscan -fnkC fc | awk '&lt;BR /&gt;/^fc/ {&lt;BR /&gt;        getline&lt;BR /&gt;        command = "fcmsutil " $NF&lt;BR /&gt;        while ( command | getline line )&lt;BR /&gt;        {&lt;BR /&gt;                split ( line, item, " = " )&lt;BR /&gt;                sub ( /^[[:space:]]+/, "", item[1] )&lt;BR /&gt;                value[item[1]] = item[2]&lt;BR /&gt;        }&lt;BR /&gt;        close ( command )&lt;BR /&gt;        printf ( "%-10s %20s %20s\n",&lt;BR /&gt;                        value["Hardware Path is"],&lt;BR /&gt;                        value["N_Port Node World Wide Name"],&lt;BR /&gt;                        value["N_Port Port World Wide Name"] )&lt;BR /&gt;}'&lt;BR /&gt;&lt;BR /&gt;Sorry having no fcd devices but fc.&lt;BR /&gt;I trust you will adapt it.&lt;BR /&gt;&lt;BR /&gt;Please be careful: there are spaces surrounding the equal sign in the split function.&lt;BR /&gt;&lt;BR /&gt;Have a nice day,&lt;BR /&gt;&lt;BR /&gt;Jean-Philippe&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 03 Jul 2010 12:22:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655790#M677214</guid>
      <dc:creator>Jean-Philippe Henry</dc:creator>
      <dc:date>2010-07-03T12:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655791#M677215</link>
      <description>Steven,&lt;BR /&gt;&lt;BR /&gt;Here is another fun program, with same output format: (PATH, NNODE, NPORT, SPORT, SNODE ):&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;do&lt;BR /&gt; fcmsutil ${fdev} |awk -F "=" '/Hardware/ || /World/ {print $2}'| xargs| awk '{print $5,$1,$2,$3,$4}'&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Sample output will look like below: &lt;BR /&gt;0/0/4/1/0 0x50060b000060a987 0x50060b000060a986 0x2202000dec277f00 0x27e4000dec0d3081&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Raj.&lt;BR /&gt;</description>
      <pubDate>Sat, 03 Jul 2010 20:24:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655791#M677215</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2010-07-03T20:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Fun awk script. Looking to a possible improvement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655792#M677216</link>
      <description>in shell&lt;BR /&gt;set -- $(ioscan -kfnC fc )&lt;BR /&gt;while [ $# != 0 ]&lt;BR /&gt;do&lt;BR /&gt; if [ ${1#/dev/} != $1 ]&lt;BR /&gt; then&lt;BR /&gt;   eval "$( fcmsutil  $1| tr -d ' -') echo \&lt;BR /&gt; \$HardwarePathis \&lt;BR /&gt; \$N_PortNodeWorldWideName \&lt;BR /&gt; \$N_PortPortWorldWideName \&lt;BR /&gt; \$SwitchPortWorldWideName \&lt;BR /&gt; \$SwitchNodeWorldWideName"&lt;BR /&gt; fi&lt;BR /&gt; shift&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 04 Jul 2010 21:00:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fun-awk-script-looking-to-a-possible-improvement/m-p/4655792#M677216</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-07-04T21:00:15Z</dc:date>
    </item>
  </channel>
</rss>

