Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-01-2007, 03:53 PM
|
#1
|
Member
Registered: Sep 2005
Location: New Jersey, USA
Distribution: VMware V12 and V15 in Windows 10, MX Linux 23.1, Kubuntu 23.10, IBM z/VM 5.4
Posts: 559
Rep:
|
Find command with an IP address as the search aurgment
Hello all,
Looked at the man page for find but couldn't find an answer to this find question.
I want to search all files looking for the string 216.254.93.22.
I tried find / -name '216.254.93.22' -print and nothing comes up.
I'm sure this is wrong. Can anyone help me setting the find command up correctly to the his search?
Thanks.
|
|
|
11-01-2007, 04:03 PM
|
#2
|
Member
Registered: Oct 2007
Distribution: rhel, fedora, gentoo, ubuntu, freebsd
Posts: 104
Rep:
|
find looks at the filename (ie: "tell me which files are named this"), as opposed to examining the inside the file.
You're looking for grep. I recommend reading the man page for it, and paying attention to the "recursive" part
|
|
|
11-01-2007, 04:14 PM
|
#3
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908
|
Quote:
ind / -name '216.254.93.22' -print
|
Should work if the name of the file is the URL number.
If the number is inside a file, modify your command:
Quote:
find / -type f | xargs grep '216\.254\.93\.22'
|
The reason for the backslashes in the URL is that, upon expansion, the shell may interpret the dots as wildcards for any single character(s). It's then necessary to *excape* the expansion problem by using the backslash to have the dot interpreted as a dot.
|
|
|
11-02-2007, 12:40 PM
|
#4
|
Member
Registered: Sep 2005
Location: New Jersey, USA
Distribution: VMware V12 and V15 in Windows 10, MX Linux 23.1, Kubuntu 23.10, IBM z/VM 5.4
Posts: 559
Original Poster
Rep:
|
Thanks bigrigdriver. Worked as advertised.
|
|
|
All times are GMT -5. The time now is 10:32 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|