<?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 help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702391#M789743</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Which column is the Interface value in when it isn't in the fifth column?  &lt;BR /&gt;&lt;BR /&gt;If it is always in the next to last column you could use this awk snippet to get it:&lt;BR /&gt;&lt;BR /&gt;netstat -rn | grep default | awk '{print $(NF-1)}'&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
    <pubDate>Wed, 04 Jan 2006 08:55:58 GMT</pubDate>
    <dc:creator>John Poff</dc:creator>
    <dc:date>2006-01-04T08:55:58Z</dc:date>
    <item>
      <title>Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702390#M789742</link>
      <description>Hello everyone&lt;BR /&gt;I'm having some trouble trying to write a script that filters some information from an output...&lt;BR /&gt;On a HP-UX B11.00 OS, when I type netstat -rn, I get a full listing with lots of stuff. I want to filter the line that has the word "default" written on it, and get the exact text that's under the INTERFACE column, so I can get that interface name...&lt;BR /&gt;initially I tried:&lt;BR /&gt;netstat -rn | grep default | awk '{print $5}'&lt;BR /&gt;it works fine in some places, but there are others where INTERFACE is NOT the 5th column, so how can I write a script to identify what column INTERFACE is so I can properly use the AWK command, or if you have any other solutions, please help! Thanks</description>
      <pubDate>Wed, 04 Jan 2006 08:43:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702390#M789742</guid>
      <dc:creator>Samir Bittar</dc:creator>
      <dc:date>2006-01-04T08:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702391#M789743</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Which column is the Interface value in when it isn't in the fifth column?  &lt;BR /&gt;&lt;BR /&gt;If it is always in the next to last column you could use this awk snippet to get it:&lt;BR /&gt;&lt;BR /&gt;netstat -rn | grep default | awk '{print $(NF-1)}'&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Jan 2006 08:55:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702391#M789743</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2006-01-04T08:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702392#M789744</link>
      <description>Hi Samir:&lt;BR /&gt;&lt;BR /&gt;John's approach is valid, but you don't need the extra process of 'grep':&lt;BR /&gt;&lt;BR /&gt;# netstat -rn | awk '$1~/^default/ {print $(NF-1)}'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 04 Jan 2006 09:03:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702392#M789744</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-04T09:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702393#M789745</link>
      <description>Samir,&lt;BR /&gt;definitely not too nice, but seems to work:&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;#Find Interface offset&lt;BR /&gt;a=`netstat -rn | grep ^Dest`&lt;BR /&gt;#Find start column of Interface&lt;BR /&gt;start=`expr index "$a" "I"`&lt;BR /&gt;# Extract the data from the default line&lt;BR /&gt;a=`netstat -rn | grep default | cut -c ${start}-`&lt;BR /&gt;# Find first space&lt;BR /&gt;start=`expr index "$a" " "`&lt;BR /&gt;# Display until first space&lt;BR /&gt;echo $a | cut -c -${start}&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Jan 2006 09:14:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702393#M789745</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-01-04T09:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702394#M789746</link>
      <description>Hi Samir,&lt;BR /&gt;See if this helps.&lt;BR /&gt;&lt;BR /&gt;# netstat -rn | grep default | tr -s " " "\n" | grep lan&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Jan 2006 09:19:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702394#M789746</guid>
      <dc:creator>Bharat Katkar</dc:creator>
      <dc:date>2006-01-04T09:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702395#M789747</link>
      <description>Hi,&lt;BR /&gt;with a one line command:&lt;BR /&gt;netstat -rn | awk '$1~/^default/ {print $(NF-1)}'&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Thu, 05 Jan 2006 09:42:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3702395#M789747</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-01-05T09:42:40Z</dc:date>
    </item>
  </channel>
</rss>

