From b34f701b1e36a804b156c714edd601c4b9bc5bf2 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 23 Jun 2014 07:29:05 -0700 Subject: [PATCH] use comm instead of huge grep loop to filter wordlist --- xwords4/dawg/English/Makefile.top5000 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/xwords4/dawg/English/Makefile.top5000 b/xwords4/dawg/English/Makefile.top5000 index 394605258..dad5d2cae 100644 --- a/xwords4/dawg/English/Makefile.top5000 +++ b/xwords4/dawg/English/Makefile.top5000 @@ -32,11 +32,10 @@ SOURCEDICT ?= $(ENGLISH)/CSW.dict.gz # word from CSW that's also in top5000 makes the grade $(XWLANG)Main.dict.gz: $(SOURCEDICT) $(ENGLISH)/Top_5000.dict.gz - zcat $(ENGLISH)/Top_5000.dict.gz | tr [a-z] [A-Z] > /tmp/Top_5000.dict - rm -f $@ - for WORD in $$(zcat $< | tr -d '\r' | tr [a-z] [A-Z] | grep -e "^[A-Z]\{2,15\}$$"); do \ - grep -q "^$$WORD$$" /tmp/Top_5000.dict && echo $$WORD; \ - done | gzip -c > $@ + zcat $(ENGLISH)/Top_5000.dict.gz | tr [a-z] [A-Z] | sort > /tmp/Top_5000.dict + zcat $< | tr -d '\r' | tr [a-z] [A-Z] | grep -e "^[A-Z]\{2,15\}$$" | sort > /tmp/$$(basename $<) + rm -f $@ + comm -12 /tmp/$$(basename $<) /tmp/Top_5000.dict | gzip -c > $@ # Everything but creating of the Main.dict file is inherited from the # "parent" Makefile.langcommon in the parent directory.