Quote:
Originally Posted by danielbmartin
Code:
# Find words which contain
# at least 3 of the same character.
# Use sed to mimic grep.
cat < $WrdLst \
|sed -n '/\(.\).*\1.*\1/p' \
> $Work09
|
You're almost there. The problem is the '
p' command will not modify the matching line.
You can combine it with '
s', though.
Code:
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.