5

Suppose I want to find all *tex files recursively from a given directory containing foo and bar but not doe. I am looking for something like helm-do-ag, but that doesn't seem to support the not operator. So is there anything like that which supports search queries with full boolean operations, i.e. something like: "find all tex files containing (apple AND orange) OR (banana and pear) not apricot".

1
  • Try this: ag -L doe -G '\.tex$' --print0 | xargs -0 ag 'foo|bar' Nov 21, 2016 at 8:49

1 Answer 1

5

Try using the UNIX or GNU/Linux find command. It supports Boolean operations.

In Emacs you can, for example, use command find-dired, which runs find and puts the set of found files in a Dired buffer. You can then mark any number of them and then act on the marked files (e.g. A to search incrementally, Q to query-replace). (Emacs also has a grep-find command, at least for some platforms.)

find can search to any depth. It is an amazing command - practically a language unto itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.