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!!