I need help to subtract 2 of the awk result below. Could someone give me an insight?
- Find the total of rows filtered by the specified word in 12th column
- Find the total of rows filtered by the specified word in 12th column and has the specified date in column 13
- Subtract 1 and 2 and print the result
This solves problem 1
awk -F ',' '$12 ~ /<WORD>/ {count++} END {print count}' file.csv
This solves problem 2
awk -F ',' '$12 ~ /<WORD>/ && $13 ~ /<DATE>/ {count2++} END {print count2}' file.csv
Unfortunately, I'm not getting the result for problem 3 below.
awk -F ',' '$12 ~ /<WORD>/ {count++} END {print count}' file.csv; awk -F ',' '$12 ~ /<WORD>/ && $13 ~ /<DATE>/ {count2++} END {print count2}' file.csv; awk {print $count-$count2}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…