Parsing out hashes from single lines
#1
Scenario: a sql dump file that contains multiple md5 hashes, but they are all on a single line.  The goal is to parse them out to make them readable by hashcat.

While this command is functional, it runs VERY slow.

cat md5.sql | grep -i -o -w '\w\{32\}' | grep -i -v '[g-z_]' > md5_hashes_unsorted_ununiqed.hash

Is there a faster way to parse out md5 strings from single lines that contain multiple md5 hashes?
#2
Code:
egrep -o '[0-9a-fA-F]{32}' md5.sql > md5_hashes_unsorted_ununiqed.hash

or even better and much more correct (because otherwise you could get some false positives):

Code:
SELECT password INTO OUTFILE 'md5_hashes_unsorted_ununiqed.hash' FROM table;