?
Solved

Search for a file using content criteria

Posted on 2004-10-08
5
Medium Priority
?
278 Views
Last Modified: 2010-04-20
I have a newbie question. How do you search for a file(s) using their contents as the criteria?
0
Comment
Question by:DBDevOne
[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
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:ddunlea
ID: 12259523
man grep

specifically,

grep "string to search for" files_to_search
0
 

Author Comment

by:DBDevOne
ID: 12259736
Thank you what if you don't know the file name though? Do you just put a wildcard on the end? Do you need to be in the directory of the file when you run this command or does it search everywhere
0
 
LVL 5

Accepted Solution

by:
ddunlea earned 1000 total points
ID: 12259838
Use -r for recursive so specifying

grep "text" -r *

Will search all of the files starting in the current directory and working down.
0
 

Author Comment

by:DBDevOne
ID: 12259997
Nice job mister!!! Thank you.
0
 
LVL 5

Expert Comment

by:ddunlea
ID: 12260077
No problem.
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month12 days, 11 hours left to enroll

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