<?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: awk format help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051980#M434950</link>
    <description>&lt;!--!*#--&gt;Shalom,&lt;BR /&gt;&lt;BR /&gt;Here is how I'd extact.&lt;BR /&gt;&lt;BR /&gt;Data is in a file say&lt;BR /&gt;&lt;BR /&gt;while read -r data&lt;BR /&gt;do&lt;BR /&gt;  nodename=$(echo $data | awk -F: '{print $1}'&lt;BR /&gt;  lannumber=$(echo $data | awk -F: '{print $2}'&lt;BR /&gt;  ipaddy=$(echo $data | awk -F: '{print $3}'&lt;BR /&gt;done &amp;lt; file&lt;BR /&gt;&lt;BR /&gt;Not the most efficient code but brutally effective.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
    <pubDate>Fri, 08 Jun 2007 07:43:09 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2007-06-08T07:43:09Z</dc:date>
    <item>
      <title>awk format help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051979#M434949</link>
      <description>I want to take the output of cmgetconf and collect the HEARTBEAT_IP info per node. I'd like the output similar to&lt;BR /&gt;&lt;BR /&gt;node1_name:lan0:1.1.1.1&lt;BR /&gt;node1_name:lan1:2.1.1.1&lt;BR /&gt;node2_name:lan0:1.1.1.2&lt;BR /&gt;node2_name:lan1:2.1.1.2&lt;BR /&gt;&lt;BR /&gt;So far when it comes to awk all I'm good for is pattern matching. :)  Sorry, I don't need it in perl for all the perl gurus out here.&lt;BR /&gt;&lt;BR /&gt;This should be some easy points for someone.&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;-denver</description>
      <pubDate>Fri, 08 Jun 2007 07:13:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051979#M434949</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2007-06-08T07:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: awk format help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051980#M434950</link>
      <description>&lt;!--!*#--&gt;Shalom,&lt;BR /&gt;&lt;BR /&gt;Here is how I'd extact.&lt;BR /&gt;&lt;BR /&gt;Data is in a file say&lt;BR /&gt;&lt;BR /&gt;while read -r data&lt;BR /&gt;do&lt;BR /&gt;  nodename=$(echo $data | awk -F: '{print $1}'&lt;BR /&gt;  lannumber=$(echo $data | awk -F: '{print $2}'&lt;BR /&gt;  ipaddy=$(echo $data | awk -F: '{print $3}'&lt;BR /&gt;done &amp;lt; file&lt;BR /&gt;&lt;BR /&gt;Not the most efficient code but brutally effective.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 08 Jun 2007 07:43:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051980#M434950</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-06-08T07:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: awk format help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051981#M434951</link>
      <description>&lt;!--!*#--&gt;Sorry, I should've provided more detail.&lt;BR /&gt;&lt;BR /&gt;I'm taking the output of cmgetconf and want to pull the node name, lan and ip for each heartbeat ip defined.&lt;BR /&gt;&lt;BR /&gt;awk '/\ HEARTBEAT_IP|\ NETWORK_INTERFACE|NODE_NAME/&amp;amp;&amp;amp;!/^#/{print $NF}' /tmp/cmgetconf.out&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Above awk gets me this...&lt;BR /&gt;&lt;BR /&gt;node1_name&lt;BR /&gt;lan0&lt;BR /&gt;1.1.1.1&lt;BR /&gt;lan1&lt;BR /&gt;2.1.1.1&lt;BR /&gt;node2_name&lt;BR /&gt;lan0&lt;BR /&gt;1.1.1.2&lt;BR /&gt;lan1&lt;BR /&gt;2.1.1.2&lt;BR /&gt;&lt;BR /&gt;But what I really want is the output format to be...&lt;BR /&gt;&lt;BR /&gt;node1_name:lan0:1.1.1.1&lt;BR /&gt;node1_name:lan1:2.1.1.1&lt;BR /&gt;node2_name:lan0:1.1.1.2&lt;BR /&gt;node2_name:lan1:2.1.1.2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I'm not sure what need to be done w/ awk to get it there.&lt;BR /&gt;&lt;BR /&gt;-denver</description>
      <pubDate>Fri, 08 Jun 2007 07:52:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051981#M434951</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2007-06-08T07:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: awk format help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051982#M434952</link>
      <description>Hi Denver,&lt;BR /&gt;&lt;BR /&gt;This little awk script is based on cmgetconf output I found on the web, so I'm not sure that it will work for your data...&lt;BR /&gt;&lt;BR /&gt;/^NODE_NAME/ {&lt;BR /&gt;    nn=$2&lt;BR /&gt;}&lt;BR /&gt;/^NETWORK_INTERFACE/ {&lt;BR /&gt;    ni=$2&lt;BR /&gt;}&lt;BR /&gt;/^STATIONARY_IP/ {&lt;BR /&gt;    si=$2&lt;BR /&gt;    comp=1&lt;BR /&gt;}&lt;BR /&gt;comp {&lt;BR /&gt;    printf("%s:%s:%s\n",nn,ni,si)&lt;BR /&gt;    comp=0&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Fri, 08 Jun 2007 08:00:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051982#M434952</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2007-06-08T08:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: awk format help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051983#M434953</link>
      <description>I don't have cmgetconf output here to test with, but judging buy your output, you just need to save teh last fields on the lines in variables and then print all on the last line. Something like&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;awk '/ HEARTBEAT_IP/ print name ":" int ":" $NF} /NETWORK_INTERFACE/{int=$NF} /{name=$NF} |NODE_NAME/&amp;amp;&amp;amp;!/^#/{print $NF}' /tmp/cmgetconf.out&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Jun 2007 08:00:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051983#M434953</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-06-08T08:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: awk format help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051984#M434954</link>
      <description>I don't have cmgetconf output here to test with, but judging buy your output, you just need to save teh last fields on the lines in variables and then print all on the last line. Something like:&lt;BR /&gt;&lt;BR /&gt;awk '/^HEARTBEAT_IP/ print name ":" int ":" $NF} /^NETWORK_INTERFACE/{int=$NF} /^NODE_NAME/{name=$NF}' /tmp/cmgetconf.out&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Jun 2007 08:02:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051984#M434954</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-06-08T08:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: awk format help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051985#M434955</link>
      <description>Ooops, sorry for the double, and now triple post. Slip of the mouse!&lt;BR /&gt;To make up, some matching hints:&lt;BR /&gt;&lt;BR /&gt;By testing for /^word/ we force the begin-of-line anchor, making the matching process quicker, and making commented lines not match.&lt;BR /&gt;You may want to use /^ *word/ to allow for zero or more spaces before the word, but still at line start.&lt;BR /&gt;&lt;BR /&gt;An other way to deal with comments is to have the FIRST check be:&lt;BR /&gt;/ *#/ { next }&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Jun 2007 08:08:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051985#M434955</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-06-08T08:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: awk format help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051986#M434956</link>
      <description>thanks everyone, this should help a lot. Attached is cmgetconf output, cleaned up just a bit.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Jun 2007 08:19:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051986#M434956</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2007-06-08T08:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: awk format help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051987#M434957</link>
      <description>/^NODE_NAME/ {&lt;BR /&gt;    nn=$2&lt;BR /&gt;}&lt;BR /&gt;/^ *NETWORK_INTERFACE/ {&lt;BR /&gt;    ni=$2&lt;BR /&gt;}&lt;BR /&gt;/^ *HEARTBEAT_IP/ {&lt;BR /&gt;    ip=$2&lt;BR /&gt;    comp=1&lt;BR /&gt;}&lt;BR /&gt;comp {&lt;BR /&gt;    printf("%s:%s:%s\n",nn,ni,ip)&lt;BR /&gt;    comp=0&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Jun 2007 08:26:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051987#M434957</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2007-06-08T08:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: awk format help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051988#M434958</link>
      <description>Thanks Hein for your example and explanations. &lt;BR /&gt;&lt;BR /&gt;Also to spex for running his example against my cmgetconf output, it's what I was looking for.&lt;BR /&gt;&lt;BR /&gt;-denver</description>
      <pubDate>Fri, 08 Jun 2007 08:35:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-format-help/m-p/5051988#M434958</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2007-06-08T08:35:13Z</dc:date>
    </item>
  </channel>
</rss>

