Skip to main content

Remove words from file which has two or more of the same letters letters in a row [Resolved]

I have a word list, such as:

word
letter
linux
tagggs

I want to remove letter and tagggs from it (because they have two or more of the same letters in a row). Maybe this can be done using sed?


Question Credit: Slobodan Vidovic
Question Reference
Asked May 24, 2019
Posted Under: Unix Linux
6 views
1 Answers

You can use one of the regex tools that supports backreferences e.g.

sed '/\(.\)\1/d' file

grep -v '\(.\)\1' file

Change . to [[:alpha:]] if you really want to restrict it to repeated letters rather than any repeated characters.


credit: steeldriver
Answered May 24, 2019
Your Answer
D:\Adnan\Candoerz\CandoProject\vQA