From cb6ac0edad665d2b0fb742ae689535755c3c5ffa Mon Sep 17 00:00:00 2001 From: FUJISHIMA Satsuki Date: Tue, 9 Nov 2004 22:20:56 +0000 Subject: replace time-consuming grep -v with awk. in example, deinstalling time of ja-shinonome is 332x faster than before. --- japanese/k10/pkg-req | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'japanese/k10') diff --git a/japanese/k10/pkg-req b/japanese/k10/pkg-req index d94579b83c54..3fcd623e8ccd 100644 --- a/japanese/k10/pkg-req +++ b/japanese/k10/pkg-req @@ -19,6 +19,10 @@ if [ "$2x" = "INSTALLx" -a ! -d ${FONTDIR} ]; then mkdir ${FONTDIR} fi +grepv() { + awk -v SRC=$1 'BEGIN{while (getline < SRC) {ENTRY[$0]=1}} (ENTRY[$0] != 1) {print}' $2 +} + # font alias entry here! TMPFILE=/tmp/install-fonts-alias-$$ cat << EOF > ${TMPFILE} @@ -41,10 +45,10 @@ cd ${FONTDIR} touch fonts.alias cp fonts.alias fonts.alias.orig if [ "$2" = "INSTALL" ] ; then - (grep -v -e "`cat ${TMPFILE}`" fonts.alias.orig ; \ + (grepv ${TMPFILE} fonts.alias.orig ; \ cat ${TMPFILE}) > fonts.alias elif [ "$2" = "DEINSTALL" ] ; then - grep -v -e "`cat ${TMPFILE}`" fonts.alias.orig > fonts.alias + grepv ${TMPFILE} fonts.alias.orig > fonts.alias fi rm -f fonts.alias.orig ${TMPFILE} -- cgit v1.2.3