|
|
Question : AWK and splitting a string into an array
|
|
Wrote a script to pull all the various Interface IPs from a list of routers. Output from snmpwalk is in the following format: ipAdEntIfIndex.192.168.100.106 = INTEGER: 10
Want to add a pipe to the end of my snmpwalk statement that would run it through awk and then output just the ip address (192.168.100.106). Pretty sure I need to split this into an array within awk and then tweak the formatting but have never done this before. Any assistance would be appreciated.
Thanks.
|
Answer : AWK and splitting a string into an array
|
|
echo "ipAdEntIfIndex.192.168.100.106 = INTEGER: 10" | awk -F'[. ]' '{OFS=".";print $2,$3,$4,$5}'
|
|
|
|
|