This is a pretty basic question, but I can't get my head around it. I'm learning Linux and one of the questions i've been given is;
*The word sentimentalment includes the same three characters (e.g. "ent") which appear three times. The word "blayblapblam" also contains the same three characters repeated three time (e.g. "bla").
How many words can you find which contain any three characters repeated three times, like the examples "sentimentalment" and "blayblapblam", but which also begin with lower case "d". Use /usr/share/dict/words as your list of possible words and grep to find the answer. The "d" is not one of the characters considered when detecting the three-character strings.*
So far, I can return instances where the same three letters appear twice;
grep -E '^d(...).*\1' /usr/share/dict/words > output
Which to me reads, look for a word beginning with 'd', then combination of three letters, 0 or more characters before the same group (1) appearing again.
I've tried the following;
grep -E '^d(...).*\1.*\1' /usr/share/dict/words > output
Which if my understanding is correct (which it obviously isn't), returns group one, then zero or more characters, then group one again.
Can someone point out where I'm going wrong? Any help is appreciated.