I have data in format
A ((!(A1+A2)))
B (A1+A2)
C (A1 A2)
D (!(A1 A2) B1)
E (!A1+!A2)
F ((A1+A2) A3 A4)
G ((A1 A2)+(A3 A4))
I want output as
A ((!(A1+A2)))
B (A1+A2)
C (A1&A2)
D (!(A1&A2)&B1
E (!A1+!A2)
F ((A1+A2)&A3&A4)
G ((A1&A2)+(A3&A4))
So whenever there is space in column2 I want it to get replaced with &
I tried
sed 's/ /&/2' file
But there is no change I also tried
awk -F' ' '{if($2==" ")$2="&";}1' file
This also has no change getting back input file only.