Sponsored Content
Top Forums Shell Programming and Scripting trying to write a script to loop through a port info file Post 302156293 by frank_rizzo on Monday 7th of January 2008 06:16:08 PM
Old 01-07-2008
Here is simple framework you can work with.

Code:
#!/bin/ksh

cat data | while read one two
do
   case $one in 
      "HBA" ) echo "HBA is $two"
         ;;
      * ) echo "one=[$one] two=[$two]"
         ;;
   esac
done

$ ./parse.file
HBA is Port WWN: 10000000c9420b4b
one=[OS] two=[Device Name: /dev/cfg/c10]
one=[Manufacturer:] two=[Emulex]
one=[Model:] two=[LP10000DC-S]
one=[Firmware] two=[Version: 1.92a1]
one=[FCode/BIOS] two=[Version: none]
one=[Type:] two=[N-port]
one=[State:] two=[online]
one=[Supported] two=[Speeds: 1Gb 2Gb]
one=[Current] two=[Speed: 2Gb]
one=[Node] two=[WWN: 20000000c9420b4b]
 

9 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Parallel Port info?

is there a command so that i can se info about the parallel port, if there isn't a specific command for that is there a command so i can se info about the system and all ports and devices? Thanx /Nick (2 Replies)
Discussion started by: sajjan2
2 Replies

2. UNIX for Dummies Questions & Answers

getting info from microannex connected to serial port A

Hi, is there a way to get information of an annex device connected to port A ? i need to get the I.P address of the annex and the port it connected to on the annex. dori (1 Reply)
Discussion started by: dorilevy
1 Replies

3. Shell Programming and Scripting

Loop through file and write out lines to file(s)

Hi, I am new to ksh scripting so your help will be much appreciated. I have a file called file.txt which looks like this Header 20050702 20050703 ABC DEF Header 20050703 20050704 123 456 Header 20050704 20050705 XXX YYY What I am trying to do is write out each of the record... (7 Replies)
Discussion started by: Jtrinh
7 Replies

4. Programming

how to write application for 32 com port

Dear Sir, i m going to use NP5610-16 moxa device for multiport serial communication. i m using fedora-core 6 o.s. after installation it will detect serial ports as /dev/ttyr0,/dev/ttyr1...ttyr32. there are total 32 com ports. now i want to write application which monitor all serial ports and... (6 Replies)
Discussion started by: amitpansuria
6 Replies

5. Shell Programming and Scripting

How to pull info under headers in file(awk,grep,while loop)

below is an extract from my file and I am trying to use Awk and grep and a while loop to pull infomation from under neath "HBA WWN=".HBA WWN=" reoccurs all over the file but the 100000c.....number are unique and I want to be able to pull and reference specifi information under this header ever time... (2 Replies)
Discussion started by: kieranfoley
2 Replies

6. Shell Programming and Scripting

Push records to array during implicit loop and write to file

NEWBIE ALERT! Hi, I'm 1 month into learning Perl and done reading "Minimal Perl" by Tim Maher (which I enjoyed enoumously). I'm not a programmer by profession but want to use Perl to automate various tasks at my job. I have a problem (obviously) and are looking for your much appreciated help.... (0 Replies)
Discussion started by: jospan
0 Replies

7. UNIX for Dummies Questions & Answers

Unable to write to a file within a loop

Hi All, Following is the program that i have written in cygwin. The redirection of the unfound $param1 to error.txt file doesnt work.Can any one help? #!/usr/bin/sh fname=$1 sed 's/ //g' "$fname" > fname1 while read i do echo $i > file1 #param1 is script name ... (1 Reply)
Discussion started by: janardhanamk
1 Replies

8. Shell Programming and Scripting

Script to loop line in a file and add info or do echo

I have a record.txt it will update weekly, and it could be 2 lines or more ... it just echo each line to the script san jose,23.34% tampa,2.15% dallas,30.20% seattle,44.29% Unknown,16.72% How do i write a shell script to give me a test.pl or bash file which contain #!/home/perl... (8 Replies)
Discussion started by: sabercats
8 Replies

9. UNIX for Beginners Questions & Answers

How to write a Boolean variable which succeed and failed inside the if loop in shell script ?

I have if loop with multiple variable value check in if loop. How can i print only if loop satisfied variable and its value in shell script ? I dont want to check each variable in if loop. That makes my script larger. if ] then echo "Only satisfied variable with value" ... (3 Replies)
Discussion started by: prince1987
3 Replies
fcinfo(1M)																fcinfo(1M)

NAME
fcinfo - Fibre Channel HBA Port Command Line Interface SYNOPSIS
fcinfo hba-port [-l] [HBA_port_WWN...] fcinfo remote-port [-ls] [-p HBA_port_WWN] [REMOTE_port_WWN...] fcinfo [-V] fcinfo [-?] fcinfo is a command line interface that collects administrative information on fibre channel host bus adapter (HBA) ports on a host. It also collects data on any fibre channel targets that may be connected to those ports in a Storage Area Network (SAN). SUBCOMMANDS The following subcommands are supported: hba-port Lists information for the HBA port referenced by the specified HBA_port_WWN. If HBA_port_WWN is not specified, all fibre channel HBA ports on the host will be listed. remote-port Lists the remote-port information for those remote ports that are specified. If no REMOTE_port_WWN is specified, all remote ports that are visible through HBA_port_WWN are listed. OPTIONS
The following options are supported: -l, --linkstat Lists the link error statistics information for the port referenced by the specified HBA_port_WWN or REMOTE_port_WWN. -p HBA_port_WWN, --port HBA_port_WWN Retrieve remote port information from the HBA_port_WWN of the local HBA port on the host. The -p option can only be used with the remote-port subcommand and is a mandatory option. -s, --scsi-target Lists the SCSI target information for all remote ports the user has asked for. The -p, --port option must always be specified and must be a valid HBA port on the host. This HBA port will be used as the initiator for which to retrieve the SCSI level target information. Note that this will only function on remote port fibre channel World-Wide Names that support an FC4 type of SCSI. -V, --version Prints the version information. -?, --help Prints the usage information. EXAMPLES
Example 1: Listing all HBA ports The following command lists all fibre channel HBA ports on the host: # fcinfo hba-port HBA Port WWN: 210000e08b074cb5 OS Device Name: /dev/cfg/c1 Manufacturer: QLogic Corp. Model: 375-3108-xx Type: N-port State: online Supported Speeds: 1Gb 2Gb Current Speed: 2Gb Node WWN: 200000e08b074cb5 HBA Port WWN: 210100e08b274cb5 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3108-xx Type: N-port State: online Supported Speeds: 1Gb 2Gb Current Speed: 2Gb Node WWN: 200100e08b274cb5 HBA Port WWN: 210000e08b072ab5 OS Device Name: /dev/cfg/c3 Manufacturer: QLogic Corp. Model: 375-3108-xx Type: L-port State: online Supported Speeds: 1Gb 2Gb Current Speed: 2Gb Node WWN: 200000e08b072ab5 HBA Port WWN: 210100e08b272ab5 OS Device Name: /dev/cfg/c4 Manufacturer: QLogic Corp. Model: 375-3108-xx Type: N-port State: online Supported Speeds: 1Gb 2Gb Current Speed: 2Gb Node WWN: 200100e08b272ab5 Example 2: Listing HBA ports and link statistics The following command lists information for the HBA ports and the link statistics for those ports: # fcinfo hba-port -l 210000e08b074cb5 210100e08b274cb5 HBA Port WWN: 210000e08b074cb5 OS Device Name: /dev/cfg/c1 Manufacturer: QLogic Corp. Model: 375-3108-xx Type: N-port State: online Supported Speeds: 1Gb 2Gb Current Speed: 2Gb Node WWN: 200000e08b074cb5 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 HBA Port WWN: 210100e08b274cb5 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3108-xx Type: N-port State: online Supported Speeds: 1Gb 2Gb Current Speed: 2Gb Node WWN: 200100e08b274cb5 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Example 3: Listing all remote ports The following command lists all remote ports that are visible through the given HBA port: # fcinfo remote-port -p 210100e08b274cb5 Remote Port WWN: 50020f230000b4af Active FC4 Types: SCSI SCSI Target: yes Node WWN: 50020f200000b4af Remote Port WWN: 210000e08b07daa6 Active FC4 Types: SCSI SCSI Target: no Node WWN: 200000e08b07daa6 Remote Port WWN: 20030003ba27c788 Active FC4 Types: SCSI SCSI Target: yes Node WWN: 10000003ba27c788 Remote Port WWN: 210000e08b096a60 Active FC4 Types: SCSI,IP SCSI Target: no Node WWN: 200000e08b096a60 Example 4: Listing remote ports and link statistics The following command lists information for the remote ports and the link statistics for those ports: # fcinfo remote-port -l -p 210100e08b272ab5 Remote Port WWN: 210100e08b296a60 Active FC4 Types: SCSI,IP SCSI Target: no Node WWN: 200100e08b296a60 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Remote Port WWN: 20030003ba27d56d Active FC4 Types: SCSI SCSI Target: yes Node WWN: 10000003ba27d56d Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 4765165 Loss of Signal Count: 4765165 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Remote Port WWN: 210100e08b27f7a6 Active FC4 Types: SCSI SCSI Target: no Node WWN: 200100e08b27f7a6 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Remote Port WWN: 50020f230000b897 Active FC4 Types: SCSI SCSI Target: yes Node WWN: 50020f200000b897 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 7 Loss of Signal Count: 7 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Remote Port WWN: 210100e08b27daa6 Active FC4 Types: SCSI SCSI Target: no Node WWN: 200100e08b27daa6 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Remote Port WWN: 210000e08b074cb5 Active FC4 Types: SCSI,IP SCSI Target: no Node WWN: 200000e08b074cb5 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Remote Port WWN: 210100e08b296060 Active FC4 Types: SCSI SCSI Target: no Node WWN: 200100e08b296060 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Example 5: Listing all SCSI targets and link statistics The following command lists all remote ports as well as the link statistics and scsi-target information: # fcinfo remote-port -sl -p 210100e08b272ab5 Remote Port WWN: 210100e08b296a60 Active FC4 Types: SCSI,IP SCSI Target: no Node WWN: 200100e08b296a60 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Remote Port WWN: 20030003ba27d56d Active FC4 Types: SCSI SCSI Target: yes Node WWN: 10000003ba27d56d Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 4765165 Loss of Signal Count: 4765165 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 LUN: 0 Vendor: SUN Product: T4 OS Device Name: /dev/rdsk/c4t20030003BA27D56Dd0s2 LUN: 1 Vendor: SUN Product: T4 OS Device Name: /dev/rdsk/c4t20030003BA27D56Dd1s2 Remote Port WWN: 210100e08b27f7a6 Active FC4 Types: SCSI SCSI Target: no Node WWN: 200100e08b27f7a6 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Remote Port WWN: 50020f230000b897 Active FC4 Types: SCSI SCSI Target: yes Node WWN: 50020f200000b897 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 7 Loss of Signal Count: 7 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 LUN: 0 Vendor: SUN Product: T300 OS Device Name: Unknown LUN: 1 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d1s2 LUN: 2 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d2s2 LUN: 3 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d3s2 LUN: 4 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d4s2 LUN: 5 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d5s2 LUN: 6 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d6s2 LUN: 7 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d7s2 LUN: 8 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d8s2 LUN: 9 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d9s2 LUN: 10 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d10s2 LUN: 11 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d11s2 LUN: 12 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d12s2 LUN: 13 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d13s2 LUN: 14 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d14s2 LUN: 15 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d15s2 Remote Port WWN: 210100e08b27daa6 Active FC4 Types: SCSI SCSI Target: no Node WWN: 200100e08b27daa6 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Remote Port WWN: 210000e08b074cb5 Active FC4 Types: SCSI,IP SCSI Target: no Node WWN: 200000e08b074cb5 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Remote Port WWN: 210100e08b296060 Active FC4 Types: SCSI SCSI Target: no Node WWN: 200100e08b296060 Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 0 Invalid CRC Count: 0 Example 6: Listing SCSI target information The following command lists all remote ports as well as the scsi-target information: # fcinfo remote-port -s -p 210100e08b272ab5 Remote Port WWN: 210100e08b296a60 Active FC4 Types: SCSI,IP SCSI Target: no Node WWN: 200100e08b296a60 Remote Port WWN: 20030003ba27d56d Active FC4 Types: SCSI SCSI Target: yes Node WWN: 10000003ba27d56d LUN: 0 Vendor: SUN Product: T4 OS Device Name: /dev/rdsk/c4t20030003BA27D56Dd0s2 LUN: 1 Vendor: SUN Product: T4 OS Device Name: /dev/rdsk/c4t20030003BA27D56Dd1s2 Remote Port WWN: 210100e08b27f7a6 Active FC4 Types: SCSI SCSI Target: no Node WWN: 200100e08b27f7a6 Remote Port WWN: 50020f230000b897 Active FC4 Types: SCSI SCSI Target: yes Node WWN: 50020f200000b897 LUN: 0 Vendor: SUN Product: T300 OS Device Name: Unknown LUN: 1 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d1s2 LUN: 2 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d2s2 LUN: 3 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d3s2 LUN: 4 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d4s2 LUN: 5 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d5s2 LUN: 6 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d6s2 LUN: 7 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d7s2 LUN: 8 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d8s2 LUN: 9 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d9s2 LUN: 10 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d10s2 LUN: 11 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d11s2 LUN: 12 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d12s2 LUN: 13 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d13s2 LUN: 14 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d14s2 LUN: 15 Vendor: SUN Product: T300 OS Device Name: /dev/rdsk/c4t50020F230000B897d15s2 Remote Port WWN: 210100e08b27daa6 Active FC4 Types: SCSI SCSI Target: no Node WWN: 200100e08b27daa6 Remote Port WWN: 210000e08b074cb5 Active FC4 Types: SCSI,IP SCSI Target: no Node WWN: 200000e08b074cb5 Remote Port WWN: 210100e08b296060 Active FC4 Types: SCSI SCSI Target: no Node WWN: 200100e08b296060 See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNW | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ attributes(5) ERROR MESSAGES
Errors that can occur in addition to the errors normally associated with system administration commands: HBA_port_WWN: not found REMOTE_port_WWN: not found 17 Feb 2005 fcinfo(1M)
All times are GMT -4. The time now is 10:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy