I need some help in locating lines in a text file that contain duplicate characters. I prefer using bash, but any other method will do fine :)
A small example just to make things clear:
file.txt:
1234
11234
abcd
12234
ab321
1233
zs11w
12w2
the desired output:
11234
12234
1233
zs11w
12w2
Thanks for all your help!
grep '\(.\).*\1' file.txt
Matches any line that contains a character, any string, and then that same character, i.e. any line with duplicates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With