I want to use Unix for the following. In a csv-file of 1,800 columns and 100 rows, looking like this
Dog Cat Rabbit Horse Chicken
Sample1 0 2 10 0 30
Sample2 10 0 0 0 0
Sample3 0 40 0 20 0
Sample4 0 0 14 0 20
Sample5 7 13 25 0 0
The empty columns only have zeros, but I only want info on the filled columns.
First, I want to know how many columns are filled per sample; with the this amount being listed like:
Sample1 3
Sample2 1
Sample3 2
Sample4 2
Sample5 3
Second, I want to know which animals match each row:
Sample1 Cat,Rabbit,Chicken
Sample2 Dog
Sample3 Cat,Horse
Sample4 Rabbit,Chicken
Sample5 Dog,Cat,Rabbit
Comments
Post a Comment