I have a numeric table, that is all cells have numbers. It is a tab-delimited file, with non-numeric headers and row names. I need to delete all columns that add up zero. I would like to keep the first column (row names), and the headers of the rest of the columns that were not removed.
Input
a b c d
e 1 2 0
f 3 4 0
g 5 6 0
Output
a b c
e 1 2
f 3 4
g 5 6
Analogous problem but with rows: delete lines that sum to zero
awk solution would be awesome; I want to avoid loading huge files in R.