Originally Posted by danielbmartin
# Find words which contain
# at least 3 of the same character.
# Use sed to mimic grep.
cat < $WrdLst \
|sed -n '/\(.\).*\1.*\1/p' \
You're almost there. The problem is the 'p
' command will not modify the matching line.
You can combine it with 's
sed -n 's/.*\(.\).*\1.*\1/\1 &/p'
where I used '&
' to reference the entire matched expression. I also had to add a '.*
' at the begining of my regex to match the begining of the word.