Solved

AWK and splitting a string into an array

Posted on 2007-03-26
3
821 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
  • 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux script help 27 245
OwnCloud Development and/or customization.. 19 991
Problem to telnet 23 165
Shell script for mvn build 2 69
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 demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now