?
Solved

AWK and splitting a string into an array

Posted on 2007-03-26
3
Medium Priority
?
828 Views
Last Modified: 2012-06-27
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.
0
Comment
Question by:lourite
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 18795305
echo "ipAdEntIfIndex.192.168.100.106 = INTEGER: 10" | awk '{sub(/[^.]*./,"");sub(/ .*/,"");print}'
0
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 18795320
echo "ipAdEntIfIndex.192.168.100.106 = INTEGER: 10" | awk -F'[. ]' '{OFS=".";print $2,$3,$4,$5}'
0
 

Author Comment

by:lourite
ID: 18799224
Thanks for the help ozo.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month14 days, 10 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question