<?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 help to get stale path information in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098750#M90792</link>
    <description>here is my effort so far:&lt;BR /&gt;&lt;BR /&gt;awk '/START OUTPUT SANCheck/,/END OUTPUT SANCheck/ {if($1 ~ /^cgcu.*$/) print $1};{if($0 ~ /stale/) print}' stuff.dat &lt;BR /&gt;&lt;BR /&gt;cgcu180a.eu.unilever.com&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;cgcu370a.eu.unilever.com&lt;BR /&gt;   2 to SCSI: 0 stale&lt;BR /&gt;   2 to SCSI: 0 stale&lt;BR /&gt;cgcu005a.eu.unilever.com&lt;BR /&gt;cgcu007a.eu.unilever.com&lt;BR /&gt;cgcu008a.eu.unilever.com&lt;BR /&gt;cgcu009a.eu.unilever.com&lt;BR /&gt;cgcu010a.eu.unilever.com&lt;BR /&gt;cgcu012a.eu.unilever.com&lt;BR /&gt;cgcu018a.eu.unilever.com&lt;BR /&gt;   1 to SCSI: 2 stale&lt;BR /&gt;&lt;BR /&gt;not quite there yet ....</description>
    <pubDate>Wed, 19 Mar 2008 13:35:48 GMT</pubDate>
    <dc:creator>lawrenzo_1</dc:creator>
    <dc:date>2008-03-19T13:35:48Z</dc:date>
    <item>
      <title>awk help to get stale path information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098748#M90790</link>
      <description>Hello all,&lt;BR /&gt;&lt;BR /&gt;Please can someone help me with awk syntax ...&lt;BR /&gt;&lt;BR /&gt;I have a report that details servers / fibre cards and whether there are any stale paths.  I want the awk sytax to only report on the server, disk and stale paths when the string "stale is present" here is a snippit from my report:&lt;BR /&gt;&lt;BR /&gt;Start task on cgcu180a&lt;BR /&gt;# START OUTPUT SANCheck&lt;BR /&gt;cgcu180a.eu.unilever.com&lt;BR /&gt;hwmgr: Refresh component database operation was successful&lt;BR /&gt;hwmgr: Refresh component database operation was successful&lt;BR /&gt;hwmgr: Refresh component database operation was successful&lt;BR /&gt;hwmgr: Refresh component database operation was successful&lt;BR /&gt;hwmgr: Refresh SCSI database operation was successful&lt;BR /&gt;&lt;BR /&gt;        ADAPTER   LINK    LINK             FABRIC     SCSI     CARD&lt;BR /&gt; HWID:  NAME      STATE   TYPE             STATE      BUS      MODEL&lt;BR /&gt;--------------------------------------------------------------------------------&lt;BR /&gt;   47:  emx0      up      point-to-point   attached   scsi3    FCA-2354&lt;BR /&gt;   49:  emx2      up      point-to-point   attached   scsi4    FCA-2354&lt;BR /&gt;   65:  emx3      up      point-to-point   attached   scsi5    FCA-2354&lt;BR /&gt;   67:  emx4      up      point-to-point   attached   scsi6    FCA-2354&lt;BR /&gt;--------------------------------------------------------------------------------&lt;BR /&gt;STALE Paths&lt;BR /&gt;-----------------------&lt;BR /&gt;   4 PATHS to dsk11132  (HWID:514)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11078  (HWID:517)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11079  (HWID:518)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   2 PATHS to dsk11135  (HWID:519)&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   8 PATHS to dsk3806   (HWID:521)&lt;BR /&gt;   2 to SCSI: 3 valid&lt;BR /&gt;   2 to SCSI: 4 valid&lt;BR /&gt;   2 to SCSI: 5 valid&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   8 PATHS to dsk14001  (HWID:70)&lt;BR /&gt;   2 to SCSI: 3 valid&lt;BR /&gt;   2 to SCSI: 4 valid&lt;BR /&gt;   2 to SCSI: 5 valid&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   8 PATHS to dsk14002  (HWID:71)&lt;BR /&gt;   2 to SCSI: 3 valid&lt;BR /&gt;   2 to SCSI: 4 valid&lt;BR /&gt;   2 to SCSI: 5 valid&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   8 PATHS to dsk14003  (HWID:72)&lt;BR /&gt;   2 to SCSI: 3 valid&lt;BR /&gt;   2 to SCSI: 4 valid&lt;BR /&gt;   2 to SCSI: 5 valid&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   8 PATHS to dsk14004  (HWID:73)&lt;BR /&gt;   2 to SCSI: 3 valid&lt;BR /&gt;   2 to SCSI: 4 valid&lt;BR /&gt;   2 to SCSI: 5 valid&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;  10 PATHS to dsk14005  (HWID:74)&lt;BR /&gt;   2 to SCSI: 3 valid&lt;BR /&gt;   2 to SCSI: 4 valid&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 valid&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   2 PATHS to dsk11137  (HWID:606)&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;      4 PATHS to dsk11050  (HWID:406)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11051  (HWID:407)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11052  (HWID:408)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11054  (HWID:410)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11055  (HWID:411)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11056  (HWID:412)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11062  (HWID:415)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11063  (HWID:416)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11064  (HWID:417)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11065  (HWID:418)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11066  (HWID:419)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11070  (HWID:421)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11071  (HWID:422)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;   4 PATHS to dsk11072  (HWID:423)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;# END OUTPUT SANCheck&lt;BR /&gt;End task on cgcu180a.eu.unilever.com&lt;BR /&gt;Start task on cgcu370a.eu.unilever.com&lt;BR /&gt;# START OUTPUT SANCheck&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;so I am looking for the below output only to report on the disk with stale paths&lt;BR /&gt;&lt;BR /&gt;cgcu180a&lt;BR /&gt;4 PATHS to dsk11072  (HWID:423)&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 6 valid&lt;BR /&gt;&lt;BR /&gt;I am working this out slowly but not getting very far ....&lt;BR /&gt;&lt;BR /&gt;the problem I have is for awk to identify stale then report the disk section ....&lt;BR /&gt;&lt;BR /&gt;any help is greatly appreciated as always :-)&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Wed, 19 Mar 2008 13:18:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098748#M90790</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-03-19T13:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: awk help to get stale path information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098749#M90791</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;# awk '/PATHS/ {LAST=$0};/stale/ {print LAST;print $0;getline;print $0}' file&lt;BR /&gt;&lt;BR /&gt;...or, of course, simple pipe the command's output to the awk script above.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 19 Mar 2008 13:25:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098749#M90791</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-03-19T13:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: awk help to get stale path information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098750#M90792</link>
      <description>here is my effort so far:&lt;BR /&gt;&lt;BR /&gt;awk '/START OUTPUT SANCheck/,/END OUTPUT SANCheck/ {if($1 ~ /^cgcu.*$/) print $1};{if($0 ~ /stale/) print}' stuff.dat &lt;BR /&gt;&lt;BR /&gt;cgcu180a.eu.unilever.com&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;   2 to SCSI: 5 stale&lt;BR /&gt;cgcu370a.eu.unilever.com&lt;BR /&gt;   2 to SCSI: 0 stale&lt;BR /&gt;   2 to SCSI: 0 stale&lt;BR /&gt;cgcu005a.eu.unilever.com&lt;BR /&gt;cgcu007a.eu.unilever.com&lt;BR /&gt;cgcu008a.eu.unilever.com&lt;BR /&gt;cgcu009a.eu.unilever.com&lt;BR /&gt;cgcu010a.eu.unilever.com&lt;BR /&gt;cgcu012a.eu.unilever.com&lt;BR /&gt;cgcu018a.eu.unilever.com&lt;BR /&gt;   1 to SCSI: 2 stale&lt;BR /&gt;&lt;BR /&gt;not quite there yet ....</description>
      <pubDate>Wed, 19 Mar 2008 13:35:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098750#M90792</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-03-19T13:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: awk help to get stale path information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098751#M90793</link>
      <description>ah missed you suggestion James ....&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;let me see if I can incorporate that with each server listed.&lt;BR /&gt;&lt;BR /&gt;Chris.</description>
      <pubDate>Wed, 19 Mar 2008 13:37:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098751#M90793</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-03-19T13:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: awk help to get stale path information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098752#M90794</link>
      <description>&lt;!--!*#--&gt;Hi (again) Chris:&lt;BR /&gt;&lt;BR /&gt;...and I missed the the host identifier in the output, do:&lt;BR /&gt;&lt;BR /&gt;# awk '/START/ {getline;print};/PATHS/ {LAST=$0};/stale/ {print LAST;print $0;getline;print $0}' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 19 Mar 2008 13:40:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098752#M90794</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-03-19T13:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: awk help to get stale path information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098753#M90795</link>
      <description>Thanks James,&lt;BR /&gt;&lt;BR /&gt;it works a treat ...&lt;BR /&gt;&lt;BR /&gt;I am still working on awk programming but not finding much time however I have come up with some syntax for easier tasks thanks to the information you provide ( and other ITRC users )&lt;BR /&gt;&lt;BR /&gt;so much appreciated!&lt;BR /&gt;&lt;BR /&gt;Chris.</description>
      <pubDate>Wed, 19 Mar 2008 13:44:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098753#M90795</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-03-19T13:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: awk help to get stale path information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098754#M90796</link>
      <description>&lt;!--!*#--&gt;&amp;gt;I am still working on awk programming&lt;BR /&gt;&lt;BR /&gt;You could do it like C, if that's a help.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;JRF: print LAST;print $0;getline;print $0&lt;BR /&gt;&lt;BR /&gt;I'm not sure why you are printing one entry after the stale entry.  This wouldn't handle stale being last.  If there were multiple stale entries, you would repeat the disk.&lt;BR /&gt;&lt;BR /&gt;The following only prints the stale entries:&lt;BR /&gt;awk '&lt;BR /&gt;BEGIN { last = "" }&lt;BR /&gt;/START OUTPUT SANCheck/ {&lt;BR /&gt;   getline&lt;BR /&gt;   print $0&lt;BR /&gt;}&lt;BR /&gt;/PATHS/ {&lt;BR /&gt;   last = $0&lt;BR /&gt;}&lt;BR /&gt;/stale/ {&lt;BR /&gt;   if (last != "") {&lt;BR /&gt;      print last&lt;BR /&gt;      last = ""&lt;BR /&gt;   }&lt;BR /&gt;   print $0&lt;BR /&gt;}' file</description>
      <pubDate>Sat, 22 Mar 2008 03:09:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-help-to-get-stale-path-information/m-p/5098754#M90796</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-03-22T03:09:56Z</dc:date>
    </item>
  </channel>
</rss>

