Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Listing files that contain IP addresses

Posted on 2006-11-15
8
Medium Priority
?
264 Views
Last Modified: 2010-08-05
Hi Experts,

how can i list all the files on my system which has IP addresses in them?

Thanks a lot
Vamsi
0
Comment
Question by:vamsi_uk
[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
8 Comments
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 17947056

find / | grep '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'

Note that this will list files with names that appear like IP address.  There's no guarantee that the name is an actual address.



Good Luck,
Kent
0
 
LVL 4

Author Comment

by:vamsi_uk
ID: 17947156
Hi kdo,

I think my question was not clearly written, sorry for that. What i meant is that i want to list the name of the files that contain an IP address inside that file contents (not in the file name)

thanks
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 17947248

Use grep to do the same.  Though I suggest that you use it on selected directories and not the entire system.

To search from the current directory (and all subdirectories) try this:

grep -lR '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' .


Kent
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Author Comment

by:vamsi_uk
ID: 17947308
Hi kdo,

I have tried the command that you gave me and i got this error message:

root@server1:/data>  grep -lR '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' .

grep: illegal action -- R
Usage: grep -hblcnsviw pattern file . . .

Btw: Im using solaris 7, is that why im getting this problem?
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 17947350

Yeah.  The 'R' option means recursively check subdirectories but it isn't a universal option.  I don't know what option you'll need in a Solaris environment.



Kent
0
 
LVL 58

Assisted Solution

by:amit_g
amit_g earned 600 total points
ID: 17948701
Try it this way...

find . | xargs grep -l -e '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'
0
 
LVL 48

Accepted Solution

by:
Tintin earned 600 total points
ID: 17950339
amit_g

close, but no cigar.  Standard Solaris grep doesn't have a -e option, but the POSIX version does, but that doesn't support extended regular expressions.

Change to

find . | xargs egrep -l  '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'
0
 
LVL 4

Author Comment

by:vamsi_uk
ID: 17956353
thanks a lot guys, i've got the expected results with that solution., im increasing the points and sharing between you both.

Cheers!
Vamsi
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

650 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