![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
AWK Help for linkloop
Hello masters of scripting,
I am trying do a small script that will do linkloop tests on interfaces, and I need your help. Here is a sample output of just a bare lanscan (minus a few interfaces): lanscan Hardware Station Crd Hdw Net-Interface NM MAC HP-DLPI DLPI Path Address In# State NamePPA ID Type Support Mjr# 0/5/1/0/4/0 0x001A4BF56734 2 UP lan2 snap2 1 ETHER Yes 119 0/5/1/0/4/1 0x001A4BF56735 3 UP lan3 snap3 2 ETHER Yes 119 I thought I was on to something when I was able to get the following formated output: # lanscan | grep -v Hardware | grep -v Path | awk '{print $3, $2}' 2 0x001A4BF56734 3 0x001A4BF56735 4 0x001A4BF56736 5 0x001A4BF56737 6 0x001A4BF56394 7 0x001A4BF56395 8 0x001A4BF56396 9 0x001A4BF56397 0 0x001A4B0766B6 1 0x001A4B0766B7 And then I put the output into a for loop, and it falls apart: for i in `lanscan | grep -v Hardware | grep -v Path | awk '{print $3, $2}'` do echo linkloop -i $i done linkloop -i 2 linkloop -i 0x001A4BF56734 linkloop -i 3 linkloop -i 0x001A4BF56735 linkloop -i 4 linkloop -i 0x001A4BF56736 linkloop -i 5 linkloop -i 0x001A4BF56737 linkloop -i 6 linkloop -i 0x001A4BF56394 linkloop -i 7 linkloop -i 0x001A4BF56395 linkloop -i 8 linkloop -i 0x001A4BF56396 linkloop -i 9 linkloop -i 0x001A4BF56397 linkloop -i 0 linkloop -i 0x001A4B0766B6 linkloop -i 1 linkloop -i 0x001A4B0766B7 Please help!! |
|
||||
|
Final Solution:
lanscan | awk '/[0-9]/{print $3, $2}' | while read i do echo LAN `echo $i | awk '{print $1}'` echo linkloop -i $i echo "----------------------" linkloop -i $i echo done Output: LAN 0 linkloop -i 0 0x00306E13F682 ---------------------- Link connectivity to LAN station: 0x00306E13F682 error: expected primitive 0x30, got DL_ERROR_ACK dl_error_primitive = 0x2d dl_errno = 0x04 dl_unix_errno = 57 error - did not receive data part of message LAN 2 linkloop -i 2 0x00306E0C541F ---------------------- Link connectivity to LAN station: 0x00306E0C541F -- OK LAN 3 linkloop -i 3 0x00306E38D363 ---------------------- Link connectivity to LAN station: 0x00306E38D363 -- OK LAN 1 linkloop -i 1 0x00306E21D5B7 ---------------------- Link connectivity to LAN station: 0x00306E21D5B7 -- OK |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|