Skip to main content
3 of 4
Improved formatting and link to CLI switches

You could use Perl:

perl -wne 'print if (/term1/ && /term2/) || (/term1/ && (/term3/ xor /term4/))'
michas
  • 21.9k
  • 5
  • 71
  • 95