Q:

Delete row if same value in all columns

I have a space-delimited large file with thousands of rows and columns. I would like to remove all lines which have the same value across all columns but the first.
Input:
CHROM   108 139 159 265 350 351
SNP1    -1  -1  -1  -1  -1  -1
SNP2    2   2   2   2   2   2
SNP3    0   0   0   -1  -1  -1
SNP4    1   1   1   1   1   1
SNP5    0   0   0   0   0   0

Desired
CHROM   108 139 159 265 350 351
SNP3    0   0   0   -1  -1  -1

There is a similar question asked for the Panda Framework  (Delete duplicate rows with the same value in all columns in pandas) and I found a somewhat partial solution that removes lines containing only zero
awk 'NR > 1{s=0; for (i=3;i<=NF;i++) s+=$i; if (s!=0)print}' input > outfile

but I want to do this for the numbers -1, 0, 1 and 2 in one go with header and 1st column as the identifier.
Any help will be highly appreciated.

A:

I believe you can do something like this:
awk '{s=$0; gsub(FS $2,FS)} (NF > 1) {print s}' file

Which outputs:
CHROM   108 139 159 265 350 351
SNP3    0   0   0   -1  -1  -1

How does this work?

{s=$0; gsub(FS $2,FS)}: This action contains 2 parts:

Store the current line in variable s
Substitute in the current line $0 all values of the second field including its starting field separator FS (FS $2) with a field separator FS. This has as a side effect the $0 is redefined and all field variables and the total number of field NF are redefined. The field separator FS is needed to avoid matching xx if $2=x

(NF > 1) {print s}: If you have more then 1 field left, print the line, it means you have various numbers.

