I cant really wrap my head around BOOLEAN logic when I use NOT together with AND and OR
- by Bq
Im trying to understand how boolean logic works when I use NOT. To give an example using awk
I have a text file containing
CORE
PORT
CORE
PORT
COREPORT
CORE
COREPORT
And I would like to remove all COREPORT lines. The way I thought I would do it was with (NOT CORE) AND (NOT PORT) eg
awk '/!CORE/&&/!PORT/{print}'
But when I try it out Im actually supposed to use OR instead of AND
awk '/!CORE/||/!PORT/{print}'
I would be really glad if some one could explain where my thinking is wrong and super glad if it could be visualized with a venn diagram or something like the boolean machine at kathyschrock