?
Solved

Search for a file using content criteria

Posted on 2004-10-08
5
Medium Priority
?
276 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
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 several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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 Month10 days, 15 hours left to enroll

770 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