Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Why is | called "infix operator", when it means "OR" here? Also, your answer will not output following lines, if they start with whitespace. Commented Jul 14, 2016 at 17:24
  • That is a good question for which I do not know the answer. I believe the pertinent information is contained in the second half of that sentence: the resulting regular expression matches any string matching either subexpression. As for a leading whitespace, it works on any line containing ERROR, FAIL, or WARN on my system. I have edited the answer to include GNU. Commented Jul 14, 2016 at 17:38
  • Ok, thanks for looking that up. I often use the word "infix", in the context "Reverse incremental infix search" (CTRL-R), but i had never seen it written in the context you quoted. 2) I meant lines, that start with whitespace, but follow a line containing the keyword, while not themselves containing the keyword. Commented Jul 14, 2016 at 17:44
  • This is the correct answer. +1. (I had misunderstood OP's desired input format.) Commented Jul 14, 2016 at 18:25
  • @AlexStragies I've sort of found the issue that has me saying some things aren't working. The actual log file that I want to pull errors from won't work with any of the commands in this thread, but the same exact text (copied/pasted word for word from the original) pasted into a fresh text file works. I have both read/write permissions, so I'm not sure why the original log or even duplicates of it won't obey. Commented Jul 14, 2016 at 22:24