Consider this situation where i have many files under a folder "Example".And if i need to find a file which contains a specific phrase like "Class Example", how do i do it with a linux shell?
is there any "locate" like functions in linux to do this?
Thanks,
Balan
Use good ol'
grep
:where
"Class Example"
is the search string andExample
is the directory, and-R
specifies recursive search.If you want a gui, and/or fast results,Beagle is a nice solution that I use. Beagle Main Page.
You can do this using egrep "text1|text2" * or using grep, and cscope is also a good tool for searching and editing..
You can try something like this:
List of file names containing a given text
You can use a combination of
find
withgrep
to find the list of filenames containing the text as below.Even if you are not use about the case like "Class" vs "class", you can use the
-i
switch to ignore case. Also if you know the file extension, you can give that to the-name
attribute. You can read further details here.