0
I am having a text file like the following:
1 2 3 4 5 6 7 8 9 ... n <-- column numbering
1 0 0 1 0 0 0 1 0 ... 0
0 1 0 0 0 0 0 0 0 ... 1
1 0 0 0 0 0 0 1 1 ... 0
0 1 1 1 0 1 0 0 0 ... 0
0 1 0 0 1 0 1 0 1 ... 1
Actually is a very sparse matrix, where binary values. In each row there should be more than one 1s and in each column at least one 1.
What I want to do is find out which columns have let's say less than 2 1s. For example in my matrix above I would like to get rid of columns 3, 5, 6 and 7 because they only have one 1.
Is there an UNIX command to do that? Probably I need a Group by-like (SQL) command and then keep track of which columns are less than a certain number, but I don't see how I could do it.
Nope. If you were zapping rows that had <2 1s, then it would be no problem. The original question will require some programming. – johntellsall – 2014-06-02T18:32:17.343