Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/awk -f
- /switchName:/ \
- {
- switchname=$2
- }
- /Effective configuration:/ \
- {
- hit=1
- }
- /alias:/ \
- {
- if(hit == 1)
- {
- if(NF == 2)
- {
- sub(/\r/,"")
- sub(/\n/,"")
- alias=$2
- getline
- aliaswwn=tolower($1)
- wwnarray[aliaswwn]=alias
- }
- else
- {
- sub(/\r/,"")
- sub(/\n/,"")
- alias=$2
- aliaswwn=tolower($3)
- wwnarray[aliaswwn]=alias
- }
- }
- }
- /Online.*FC.*F-Port/ \
- {
- if(hit == 1)
- {
- portindex=$1
- portwwn=tolower($NF)
- connectedwwn[switchname][portindex]=portwwn
- if(NF >= 10)
- {
- portslot[switchname][portindex]=$2"/"$3
- }
- else
- {
- portslot[switchname][portindex]=$2
- }
- }
- }
- END \
- {
- OFS="\t"
- for(i in connectedwwn)
- {
- for(j in connectedwwn[i])
- {
- k=connectedwwn[i][j]
- # print wwnarray[k],i,j,portslot[i][j]
- printf "%-20s %-5s %-6s %s\n",i,j,portslot[i][j],wwnarray[k]
- }
- }
- }
Add Comment
Please, Sign In to add comment