• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

Finding files that contain certain text


I use this:
       grep myscript.cgi * -R

to find ALL files in a directory / subdirectories that contain specific text.  It displays the
filename AND the line containing the text.

I JUST want it to display the filename ONLY.

  • 2
1 Solution
Kerem ERSOYPresidentCommented:

I guess

grep -H -R myscript.cgi * | cut -f1 -d:

will do.
Kerem ERSOYPresidentCommented:
in fact grep with -l switch will do it too :) so.

grep -l -R myscript.cgi *

-l (Lima not India)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now