I have a few grep expressions that aren't working as I intended and I cannot figure out as to why.
The first expression is to find lines that start and end with the same character. This is the expression I am using...
grep -E '(.).*\1$' input
The second expression is very similar as it is to find lines that have the same 2nd character and second to last character...
grep -E '(.)(.).*\2.$' input
The last expression is to find lines with only a single word and end with a punctuation...
grep -E '(\w){1}.*[[:punct:]]$' input
I don't understand why these are not working, am i doing something terribly wrong or just a simple mistake?