Subject: bug#41687: regex search for indexed files

From: Assaf Gordon <[email-masked]>
Date: Sat, 6 Jun 2020 22:45:03 -0600

tag 41687 notabug
close 41687
stop

Hello,

On 2020-06-03 8:27 a.m., Peng Yu wrote:
> grep can do regex search but it needs to scan each file. When the
> number of files are large, it can be slow.
> 
> Is there an alternative tool that can do regex search in the indexed
> files (including .docx .pdf and other commonly used file formats that
> can be converted to text) so that the search can be fast?

It seems you are mixing several questions together.

1. If you want "grep" to search only specific set of files,
use the "--include" or "--exclude" options.
Or better yet, use find+xargs+grep .

2. If you want to search in non-text files, use appropriate programs
that understand the file format (e.g. "pdfgrep")
or programs that can convert the custom format to text (e.g. "antiword" 
and "wv").

3. You've mentioned "indexed files" - if you're looking for a program
that scans files and indexes them, and then allows you to search the 
index, look for "Desktop search" programs, e.g. 
https://en.wikipedia.org/wiki/List_of_search_engines#Desktop_search_engines
https://en.wikipedia.org/wiki/Recoll
https://en.wikipedia.org/wiki/Tracker_(search_software)

---

Lastly,
For all of these topics, a simple internet search would have given you
the above results. PLEASE respect everyone's time by first doing 
searching for answers yourself, before posting questions on a public 
mailing list.

---

Since this is not a bug in grep, I'm marking this as "closed".

regards,
  - assaf