[Solved] How to create a logic that substract results of two awk logics?


If you run multiple awk commands, the variables used are not shared. If you want them to be shared, you could combine the commands into a single program:

awk -F ',' '
    $12 ~ /<WORD>/ {count++}
   '$12 ~ /<WORD>/ && $13 ~ /<DATE>/ {count2++}
   END {print $count-$count2}
' file.csv

However, your three specifications seem to simplify to:

print the number of the rows of a csv file file.csv which contain a specific word in column 12 and which do not contain a specific date in column 13

awk -F, '$12~/word/ && $13!~/date/ {n++} END {print n+0}' file.csv

where /word/ and /date/ are regular expressions that provide the required word and date respectively.

3

solved How to create a logic that substract results of two awk logics?