Is there anyway to use uniq
(or similar) to filter/remove sets of repeating lines from log type output? I am debugging an MPI code where multiple processors often print the same exact output. uniq
works great when the output is one line, but frequently the code will generate multiple lines. Here's an example:
calling config()
calling config()
calling config()
running main loop
time=0
running main loop
time=0
running main loop
time=0
output from Rank 0
gets filtered with uniq
(without options) to:
calling config()
running main loop
time=0
running main loop
time=0
running main loop
time=0
output from Rank 0
is there an easy way to filter n-line blocks? I've read and reread the manpage but can't find anything obvious. Thanks!
UPDATE: I'd like the output to have duplicated blocks condensed down to a single entry, so in the case of the example above:
calling config()
running main loop
time=0
output from Rank 0
running main loop
blocks where thetime
statement is not equal 0? – AdminBee May 08 '20 at 09:02