performance - Egrep command hangs when passed a file for Regex patterns -
nb: i'm using cygwin.
passing in file egrep command use patterns running incredibly (to point after 4th word match, more 5 minutes before gave up). command i'm trying run is:
cat words.txt | egrep ^"[a-z]" | egrep -f words9.txt
words.txt dictionary (390k words), , words9.txt file (36,148 words) created contains lowercase 9-letter words word.txt. command should find 10+ letter words contain 9-letter word words9.txt.
i new regex , shell commands may file dependency incredibly inefficient method, (having search 36148 words every word in words.txt). there better way of tackling this?
if words9.txt
doesn't have regexes try using fixed string search (fgrep
or grep -f
) instead of using extended regex search (egrep
).
cat words.txt | egrep "^[a-z]" | fgrep -f words9.txt
Comments
Post a Comment