0

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?

3

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.

  • that's removing lines, not words. but it works for that input format – Jasen May 25 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.