0

I have a build log file that includes information on issues reported by clang-tidy. Each of the lines in the log file that reference an issue identified by clang-tidy contain the string "warning G". The problem is that the vast majority of the issues are not in my code and most of those that are not in my code are in Boost. Each of the lines in the log file that reference an issue identified by clang-tidy in Boost also contain the string "\include\boost/". So what I need is a way to list all the lines in the buffer that contain the string "warning G" and do not contain the string "\include\boost/".

Occur gets me half way there, it allows me to list all lines that match "warning G" but I do not know how to filter out the lines that match "\include\boost/".

Benilda Key
  • 159
  • 8
  • Although there are many ways to do such things in emacs, there are many other tools as well: e.g. from a shell you can say `grep pat1 file.log | grep -v pat2` . – NickD Dec 10 '20 at 02:41
  • 1
    Does this answer your question? [Hide lines by regex](https://emacs.stackexchange.com/questions/50233/hide-lines-by-regex) – Drew Dec 10 '20 at 05:22
  • Or this duplicate: [grep eliminate suspects](https://emacs.stackexchange.com/q/59836/105). – Drew Dec 10 '20 at 05:24
  • Or this one: [Is it possible to remove matches manually in grep mode?](https://emacs.stackexchange.com/q/34487/105). – Drew Dec 10 '20 at 05:26
  • Or this: [How show (filter) only text lines with all uppercase chars?](https://emacs.stackexchange.com/q/46822/105). – Drew Dec 10 '20 at 05:27
  • Or this: [Grep pipe support and how to filter grep results](https://emacs.stackexchange.com/q/51128/105). – Drew Dec 10 '20 at 05:29
  • And there are more. We really should have a community question (and answer) that handles this in a general way. Maybe someone will write that up. – Drew Dec 10 '20 at 05:30

1 Answers1

1

You can use M-x flush-lines in the occur buffer to perform the second half. You may have to toggle the read-only state first.

phils
  • 48,657
  • 3
  • 76
  • 115