I have data in format
A ((!(A1+A2)))
B (A1A2)
C (A1+A2)
D (!(A1+A2)B1)
E (!A1+!A2)
F (!(!A1!A2)+A3+A4)
G ((A1!A2)B1)
I want output as
E (!A1+!A2)
F (!(!A1!A2)+A3+A4)
G ((A1!A2)B1)
I want to get that line which has ! only with alphanumeric.
I used
awk -F' ' '$2 ~ /\!/' file
And this also
awk '$2'~/^[(!)_[:alnum:]]+[(!)+_[:alnum:]]+$/' file
But this is listing all the lines which has ! along with ! in alphanumeric also.