I have this textfile
6 times: 5 capitals, split by a space
EWTLE YQTCE FNTMA YVTMB GWTDH QGTAL
UVGEV SPGWP HDAVZ FLRVY HVBFT OFUSG
UKAYH BOAXR BLUSG YRMZT WAIMR BOCCX
BIUCZ KYUPP ECUZI PIURZ MXUMB RDUIG
ANAZW IVAYI QNHFN UPTHC YACTJ QPRLV
Using Unix command line, egrep. I need to check if the middle character is the same in every group (here 4th line).
I tried to reverse the results if one of the letters was NOT the same, using a group. But I can't find how to do it.
egrep -v '[A-Z]{2}([A-Z])[A-Z]{2}.*[A-Z]{2}§NOT GROUP 1§[A-Z]{2}' filename
How can i fill in the part between §?
The solution i have is too long, just repeating the same for every group
egrep '[A-Z]{2}([A-Z])[A-Z]{2} [A-Z]{2}\1[A-Z]{2}
[A-Z]{2}\1[A-Z]{2} [A-Z]{2}\1[A-Z]{2} [A-Z]{2}\1[A-Z]{2} [A-Z]{2}\1[A-Z]{2}' filename