In a range of files, I want to see which line has atleast 4 times the same occurence of the same word. This word can be any word.
So input:
a a a b b e e e o o o o p p p y y y w r r r u u i i o o r x x o o i i p p z z y y
Output:
o o o o p p p y y y w r r r u u i i o o r
What I have tried at the moment is to make sure that sentences are put separate, ready to be processed basically.
cat * |
tr '\n' ' '|
sed 's/[.!?;"]/ & /g' |
sed 's/[.!?]/&\n/g'|
grep -E -w '\b([[:alnum:]]*)\{4*\}\b'
But my grep doesn't get anything, so how do I get that Grep only prints out all sentences which contain a word which occurs atleast 4 times in it?
