[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using grep to find duplicate characters in a word in bash
From: |
Bob Proulx |
Subject: |
Re: Using grep to find duplicate characters in a word in bash |
Date: |
Wed, 4 Nov 2009 22:25:31 -0700 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
LHUHCD wrote:
> Is there a regular expression that can find duplicate characters in a word?
Normally I love these types of problems and would jump right in. But
this one has two problems. One is that it was sent to bug-bash which
is a mailing list for discussion about bugs and features in the bash
shell and your question is off-topic since it has nothing to do with
bash. A better place to have asked your question would be
help-gnu-utils which is a generic discussion list for all of the gnu
utilities which would include grep.
Secondly this sounds very suspiciously like a homework assignment. :-)
Bob
> For example, for five-letter words, we would use.....
> grep "^.....$"
> .....to find any five character word
>
> How can we, at least, find five-letter words with duplicate letters in the
> word using grep in bash?
>
> ample - no
> apple - yes
> pills - yes
> civic - no (two pairs of duplicates)
> alana - no (includes "triplicate")
>
> At the very least, I am looking for a grep that finds words with at least a
> duplicate letter inside the word.
>
> Thanks!
>
>
> --
> View this message in context:
> http://old.nabble.com/Using-grep-to-find-duplicate-characters-in-a-word-in-bash-tp26202300p26202300.html
> Sent from the Gnu - Bash mailing list archive at Nabble.com.