while () { # print if /$pattern/; # normal "grep" print unless /$pattern/; # grep -v }