Is there such a thing as cached grep?
Is there such a thing as a cached grep? I am thinking of something that caches the files that grep was issued for so that it doesn't have to iterate over the directory or reload those files. Does something like this already exist?
+3
lucidquiet
source
to share
1 answer
It sounds like you really need a pipeline. Grep handles this use case well, allowing you to re-filter previously filtered results by accepting data on standard input.
For example:
# Search for "bar" in lines that have "foo."
grep foo * | grep bar
# Search for "baz" in lines that don't have "quux."
grep -v quux * | grep baz
0
Todd A. Jacobs
source
to share