I'm using Linux's terminal and i've got a wordlist which has words like:
filers
filing
filler
filter
finance
funky
fun
finally
futuristic
fantasy
fabulous
fill
fine
And I want to do a grep and a regex to match the find words with the first two letters "fi" and only show the word if it's 6 characters in total.
I've tried:
cat wordlist | grep "^fi"
This shows the words beginning with fi.
I've then tried:
cat wordlist | grep -e "^fi{6}"
cat wordlist | grep -e "^fi{0..6}"
and plenty more, but it's not bring back any results. Can anyone point me in the right direction?
It's fi
and four more characters:
grep '^fi....$'
or shorter
grep '^fi.\{4\}$'
or
grep -E '^fi.{4}$'
$
matches at the end of line.
Solution:
cat wordlist | grep -e "^fi.{4}$"
Your try:
cat wordlist | grep -e "^fi{6}"
This means f and i six times, the dot added above means any charater, so it's fi and any character 4 times. I've also put an $ to mark the end of the line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With