how to find all of the IP addresses in any and all of the files under /var/lib/output/*, ignoring whatever else may be in those files?
now i can assume anything in those files.....can some one get me started on this.

Now i know that the basic logic in this is that we should start by just find replace kind of a thing and then form an iterative operation to find ip address from all other files

Recommended Answers

All 2 Replies

Hey there,

this highly depends on the tool you decide to use. For simplicity, just use sed and type more than you need to for ease of understanding:

sed -n '/[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}/p' FILENAME

You can also expand on that to pull more than one IP from a single line and tweak so that it doesn't accept a bad ip like 999.999.999.999

Best wishes :)

, Mike

There are thousands of ways to do this one :) Try this! grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' /var/lib/output Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.