I have a list of records as following
Item1,200
Item1,200
Item3,900
Item2,500
Item2,800
Item1,600
Item4,
Item5,
Item4,100
Item5,
Item5,444
My output should be
"Please check the file as Item1 is greater than 2"
With my awk command the output is (Counting the blanks), But it should not
Item1 3
Item2 2
Item3 1
Item4 2
Item5 3
Unix command should count the items without blanks the above list and should return a statement 'please check the records' if the count of any item greater than 2 (without blanks).
I have tried with below awk command , but am unable to filter the blanks and get count greater than 2 records.
awk -F, '{a[$1]++;}END{for (i in a)print i, a[i];}' filetest.txt