LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 11-01-2007, 03:53 PM   #1
swamprat
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: Reputation: 34
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.
 
Old 11-01-2007, 04:03 PM   #2
complich8
Member
 
Registered: Oct 2007
Distribution: rhel, fedora, gentoo, ubuntu, freebsd
Posts: 104

Rep: Reputation: 17
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
 
Old 11-01-2007, 04:14 PM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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.
 
Old 11-02-2007, 12:40 PM   #4
swamprat
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: Reputation: 34
Wink

Thanks bigrigdriver. Worked as advertised.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
arp command find ethernet card address Fond_of_Opensource Linux - Networking 1 06-15-2007 07:22 AM
Find command using 2 search conditions nifflerX Linux - General 8 07-15-2005 02:37 PM
pattern search through find command. abhi Linux - Newbie 2 04-11-2005 11:31 AM
Command to find my IP address? mwheeler Linux - Networking 6 11-20-2004 06:26 AM
Command to find workstation IP address minno44 Linux - Newbie 2 10-08-2004 04:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration