I have file with data
cell input out type fun level
AI20 A1,A2 Z comb ((A1A2)) 2
IA2 A1,A2,A3 Z comb ((!A1A2)A3) 3
XOR A1,A2,B1 Z comb (((A1A2)B1) 3
IAD A1,A2,A3 Z comb (!((A1A2)A3)) 3
INV I1 ZN comb (!I1) 1
BUF A1,A2,A3,B1 Z comb (!(((A1A2)A3)B1)) 4
From this data, I want to print rows whose
level field (6th column)givessum 7together.here to get
level sum7we can selectAI2O,BUF,INVrows giving level sum as2+4+1=7and print them
Orcan selectXOR,IAD,INVgiving sum3+3+1=7and print them. Any random selection of rows work butlevel sumneeds to be7
Output can be as
cell input out type fun level
AI20 A1,A2 Z comb ((A1A2)) 2
INV I1 ZN comb (!I1) 1
BUF A1,A2,A3,B1 Z comb (!(((A1A2)A3)B1)) 4
Or output can also be
cell input out type fun level
XOR A1,A2,B1 Z comb (((A1A2)B1) 3
IAD A1,A2,A3 Z comb (!((A1A2)A3)) 3
INV I1 ZN comb (!I1) 1
I tried it using awk
awk '{{ sum[i] += $6} for (i=1;i<8;i++) print $0}' file
But this is printing each row 7 times not the desired output.
Part 2. Prblm continue to part 1.
file2 with data
cell input out type fun level
CLK C Z seq Cq 1
DFk C,Cp Q seq IQ 1
DFR D,C Qn seq IN 1
SKN SE,Q Qp seq Iq 1
Output to get for part2
cell input out type fun level
AI20 A1,A2 Z comb ((A1A2)) 2
INV I1 ZN comb (!I1) 1
BUF A1,A2,A3,B1 Z comb (!(((A1A2)A3)B1)) 4
CLK C Z seq Cq 1
XOR A1,A2,B1 Z comb (((A1A2)B1) 3
IAD A1,A2,A3 Z comb (!((A1A2)A3)) 3
INV I1 ZN comb (!I1) 1
DFk C,Cp Q seq IQ 1
IA2 A1,A2,A3 Z comb ((!A1A2)A3) 3
XOR A1,A2,B1 Z comb (((A1A2)B1) 3
INV I1 ZN comb (!I1) 1
output for part2 is that when we get level sum as 7 for file1, insert first line from file2 after it. And again check for condition for level sum 7 and if true insert second line from file2. Then again check for level sum as 7. If true insert 3rd line from file2. This is done for execution 3 times.