2

I would like to use helm to search for two terms which may well be on different lines.

Is there a way to grep for the first term then further grep within the resulting fileset the second term?

eg

Func(
   "hello"
);

I would like to grep/search for all files containing "Func" and then "hello".

I know I can save the results set to a hgrep buffer but I cant fathom how to then use that buffer's match fileset to narrow the search for the second term.

  • Does M-x helm-do-grep-ag RET Func.*\n.*hello work for you? – jagrg Feb 7 at 13:44
  • Would you accept alternatives to Helm? Elgrep allows multiple search criteria. In your case there would be two alternatives: 1st) Give "hello" as first search term and Func as second one. Elgrep would search for all files containing Func and show you the matches for "hello" within those files. 2nd) Your example looks as you would actually want to find matches for a cexp. Elgrep allows you to specify the search function. You could choose cexp-search-forward and Func\!("hello"\!) as search string. – Tobias Feb 11 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.