{"id":149,"date":"2010-07-01T14:08:39","date_gmt":"2010-07-01T19:08:39","guid":{"rendered":"http:\/\/www.hpux.ws\/?p=149"},"modified":"2010-10-29T11:23:21","modified_gmt":"2010-10-29T16:23:21","slug":"quick-and-dirty-awk-trick-to-see-all-fiber-channel-status","status":"publish","type":"post","link":"https:\/\/www.hpux.ws\/?p=149","title":{"rendered":"Quick and dirty awk trick to see all Fiber Channel status"},"content":{"rendered":"<p>I needed to update documentation and I needed more information that my prior syslayout.sh script provided on fiber.<\/p>\n<p># Improvement by JRF on the ITRC forums.<\/p>\n<p>ioscan -kfnC fc | awk \u2018\/fcd\/ {getline;fcd=$NF;print fcd,$2}\u2019 | while read -r fdev<br \/>\ndo<\/p>\n<p style=\"padding-left: 30px;\">fcmsutil ${fdev} | awk \u2018\/Hardware \/ {print $5};\/World \/ { print $7}\u2019<\/p>\n<p>done<\/p>\n<p>Ouput looks like this:<\/p>\n<p>0\/0\/12\/1\/0\/4\/0<br \/>\n0x5001438002a24979<br \/>\n0x5001438002a24978<br \/>\n0x204f000dec81b540<br \/>\n0x200f000dec81b541<\/p>\n<p>0\/0\/12\/1\/0\/4\/1<br \/>\n0x5001438002a2497b<br \/>\n0x5001438002a2497a<br \/>\n0x2093000dec81b480<br \/>\n0x2010000dec81b481<\/p>\n<p>2\/0\/12\/1\/0\/4\/0<br \/>\n0x5001438002a24d35<br \/>\n0x5001438002a24d34<br \/>\n0x2050000dec81b480<br \/>\n0x2010000dec81b481<\/p>\n<p>2\/0\/12\/1\/0\/4\/1<br \/>\n0x5001438002a24d37<br \/>\n0x5001438002a24d36<br \/>\n0x2093000dec81b540<br \/>\n0x200f000dec81b541<\/p>\n<p>Second, new improved version (Girsah Chadash)<br \/>\nioscan -kfnC fc | awk &#8216;\/fcd\/ {getline;fcd=$NF;print fcd,$2}&#8217; | while read -r fde<br \/>\nv<br \/>\ndo<\/p>\n<p style=\"padding-left: 30px;\">\nfcmsutil ${fdev} | awk &#8216;\/Hardware \/ {print $5};\/World \/ { print $7}&#8217; | awk&#8217; {printf &#8220;%s %s %s %s %s&#8221;,$1, $2, $3, $4, $5;}&#8217;<br \/>\nfcmsutil ${fdev} | awk &#8216;\/Hardware Path\/ {PATH=$5};<br \/>\n\/N_Port Node\/  {NNODE=$7};<br \/>\n\/N_Port Port\/  {NPORT=$7};<br \/>\n\/Switch Port\/  {SPORT=$7};<br \/>\n\/Switch Node\/  {SNODE=$7};<br \/>\nEND{print PATH, NNODE, NPORT, SPORT, SNODE}&#8217;<\/p>\n<p>done<\/p>\n<p>Next innovation would be to combine the awk statements in the while loop and pull off the output with a single awk command. I may do this, but I might need help from an awk guru.<\/p>\n<p>The ioscan output is multi line, so the real innovation is using the getline function of awk to get the second line of data and ignore the first. The filter \/fcd gets rid of the column format information.<\/p>\n<p>Yes it could be done with grep, but it is more AWKFUL this way.<\/p>\n<p>Updated document to provide some indentation. Trying to make the code easier to read. That may force me to add formatted scripts to download, which I will get to as time permits.<\/p>\n<p>SEP<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I needed to update documentation and I needed more information that my prior syslayout.sh script provided on fiber. # Improvement by JRF on the ITRC forums. ioscan -kfnC fc | awk \u2018\/fcd\/ {getline;fcd=$NF;print fcd,$2}\u2019 | while read -r fdev do fcmsutil ${fdev} | awk \u2018\/Hardware \/ {print $5};\/World \/ { print $7}\u2019 done Ouput looks [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_kadence_starter_templates_imported_post":false,"footnotes":""},"categories":[43,39,8],"tags":[145,23,36],"class_list":["post-149","post","type-post","status-publish","format-standard","hentry","category-hardware","category-scripting","category-sysadmin","tag-capacity-planning","tag-high-capacity-volume-group","tag-superdome"],"_links":{"self":[{"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts\/149"}],"collection":[{"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=149"}],"version-history":[{"count":11,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":167,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts\/149\/revisions\/167"}],"wp:attachment":[{"href":"https:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}