I have a text file and I want to print only the lines that have all their characters are consecutively reapeated at least two times or more. FOR EXAMPLE THE INPUT:
11 AAA 555227777 BBhh@@222 baabbb 1112 212211 baa 22333445 322113
The output should be:
11 AAA 555227777 BBhh@@222
The output contains only these four lines because they have only consecutively duplicate characters in order.
I have tried this code
grep '\(^\| \)\([ ])\2\1\($\| \)' INFILE
But its not working exactly.