How can I filter a wordlist to only include words of a certain minimum size?

3.5k Views Asked by At

I'd like to have a file/list of all passwords in rockyou.txt that are greater than or equal to 10 characters. I'd imagine there's some one-liner like cat rockyou.txt | grep (length >= 10) > output.txt but I can't get the right syntax

2

There are 2 best solutions below

2
On BEST ANSWER

Using :

awk 'length($0) >= 10' rockyou.txt

Using :

grep -P '^.{10,}' rockyou.txt

or

grep '^.\{10,\}' rockyou.txt

Using :

perl -lne 'print if length() >= 10' rockyou.txt
0
On
sudo grep -x '.\{10,X\}' rockyou.txt > NEWrockyou.txt     

where X is the maximum length you want (put a large number to get them all).