Print first colum is the condition is true using awk

I have a binary file which looks like this,

Orthogroup  A   B   C   D   E   F
OG0000000   1   1   1   0   0   0
OG0000001   1   1   1   0   0   0
OG0000002   1   1   1   0   0   0
OG0000003   1   1   1   0   0   0
OG0000004   0   0   0   1   1   0
OG0000005   0   0   0   1   1   0
OG0000006   0   0   0   1   1   0
OG0000007   0   0   0   1   1   0
OG0000008   1   0   0   0   0   0
OG0000009   1   0   0   0   0   0
OG0000010   1   0   0   0   0   0


I want to use awk to print the first column if column D and E is 1 and rest is 0.

OG0000004
OG0000005
OG0000006
OG0000007


I tried to do this with individual files of each column using the awk command

awk 'NR==FNR{arr[$$0];next}$$0 in arr' file1 file2


but doing this I had to generate multiple files and I thought using a binary file will be a more clean way.

• It would be more helpful to paste the actual text instead of pictures of it. Nov 19, 2021 at 21:31

$cat test.tsv groupA 1 1 1 0 0 0 groupB 1 1 0 0 0 0 groupC 1 0 1 0 0 0 groupD 1 1 1 0 0 0 groupE 0 0 0 1 1 1 groupF 0 0 0 1 1 0 $$awk '($$5==1 && $$6==1 &&$$2+$$3+$$4+$$7==0){print$$1}' groupF  • Thank you it worked Nov 19, 2021 at 22:12 Straightforwardly awk '$2==0 && $3==0 &&$4==0 && $5==1 &&$6==1 && $7==0 {print$1}' bin.file

awk '$5 &&$6 && !($2 ||$3 || $4 ||$7) {print \$1}' bin.file