I have a file (see below), and I would like to count the number of 1's and of 0's:
1
1
1
0
0
1
1
0
0
0
...
I tried to use awk but it doesn't work, for example, to count the number of 1's:
awk -F "1\n" '{print NF-1}'
How shall I do it?
I assume the file only contains 1's and 0's, and each line is just a single number. But I more like to know how to generalize to the case for counting the occurrences of a specific line in a file.