On Tue Aug 2, 2022 at 5:55 AM EDT, Alejandro Colomar wrote: > The thing is that I'm running mandoc(1) from a Makefile, which means > that not only stdout/stderr is important, but also the exit status. > There's no trivial way to ignore mandoc(1)'s error code for certain > warnings. Also, I run it for a few thousands of manual pages, so I > don't want make(1) to stop at every page that triggers an unwanted > warning. But I do want make(1) to stop at errors/warnings in general.
You could swap mandoc’s stderr and stdout, then filter it with sed and redirect sed to stderr: mandoc -W <level> 3>&2 2>&1 1>&3 | sed '/reg/ex/d' >&2 Of course if mandoc also normally writes to stdout this would create new stuff on stderr, so you could run it in two-passes: # pass where we care about mandoc’s regular output mandoc 2>/dev/null # pass where we care about mandoc’s errors mandoc -W <level> 2>&1 >/dev/null | sed '/reg/ex/d' >&2 (https://stackoverflow.com/questions/13299317/) Cheers, -- DJ Chase They, Them, Theirs