My data (tab divided):
1 0 0 1 0 1 1 0 1
1 1 0 1 0 1 0 1 1
1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0
...
how can I grep strings with exact, for example, 5 '1's, ideal output:
1 0 0 1 0 1 1 0 1
Also, how can I use grep strings with equal to or greater than (> =) 5 '1's, ideal output:
1 0 0 1 0 1 1 0 1
1 1 0 1 0 1 0 1 1
1 1 1 1 1 1 1 1 1
I tried,
grep 1$'\t'1$'\t'1$'\t'1$'\t'1
however, this will only output sequential '1, which is not all I want.
I wonder if there will be any easy way to achieve this, thanks!
source
share