I have some data like this and I want to extract the Var column for CCC but only for the first three months of 2018 and 2019.
ID Date Var
--- ------ ---
AAA 201701 110
BBB 201705 211
CCC 201710 312
AAA 201712 413
BBB 201801 514
CCC 201801 615
AAA 201802 716
BBB 201802 817
CCC 201803 918
AAA 201803 119
BBB 201804 220
CCC 201804 321
AAA 201901 222
BBB 201902 312
CCC 201903 111
The output should be 615,918,111.
I would like to make a pattern for the dates.
I've tried these so far
awk '/CCC/ && /201801/ && /201802/ && /201901/ && /201902/&& /201903/ { print $3 } ' file.txt
awk ' $1 ~ /CCC/ || /201801/ && /201802/ && /201901/ && /201902/&& /201903/ { print $3 } ' file.txt