search for pattern and print lines only if pattern found in more than 1 line
search for pattern and print lines only if pattern found in more than 1 line
(OP)
hi,
I'd like to check if pattern occurs in multiple lines in a file and print those lines (if pattern found only once then ignore and don't print the line).
regards, Mark.
I'd like to check if pattern occurs in multiple lines in a file and print those lines (if pattern found only once then ignore and don't print the line).
regards, Mark.
RE: search for pattern and print lines only if pattern found in more than 1 line
The simplest is to collect the matching lines and output them only ad the end if the count condition is met :
CODE --> Awk
If need to process huge amount of data, then better rewrite it to delay outputting the first match only until the second match is found.
Tested with gawk and mawk.
Feherke.
feherke.ga