wok-current annotate pm-utils/stuff/grep-x.patch @ rev 18002

Up: firefox-official (37.0.2)
author Christophe Lincoln <pankso@slitaz.org>
date Sat Apr 25 23:32:23 2015 +0200 (2015-04-25)
parents
children
rev   line source
domcox@12209 1 --- functions.in.orig
domcox@12209 2 +++ functions.in.new
domcox@12209 3 @@ -215,8 +215,22 @@
domcox@12209 4 for p in "$@"; do
domcox@12209 5 echo "$p" >> "$PARAMETERS.rm"
domcox@12209 6 done
domcox@12209 7 - # let grep do the dirty work.
domcox@12209 8 - grep -vxFf "$PARAMETERS.rm" "$PARAMETERS" > "$PARAMETERS.new"
domcox@12209 9 + # let awk do the dirty work.
domcox@12209 10 + cat "$PARAMETERS" | awk -v VAR="$(cat "$PARAMETERS.rm")" '
domcox@12209 11 + {
domcox@12209 12 + del=0
domcox@12209 13 + split(VAR,rm)
domcox@12209 14 + for(i in rm)
domcox@12209 15 + {
domcox@12209 16 + if($1==rm[i]){
domcox@12209 17 + del++
domcox@12209 18 + }
domcox@12209 19 + }
domcox@12209 20 + if(del==0)
domcox@12209 21 + {
domcox@12209 22 + print $1
domcox@12209 23 + }
domcox@12209 24 + }' > "$PARAMETERS.new"
domcox@12209 25 fi
domcox@12209 26 cp -f "$PARAMETERS.new" "$PARAMETERS"
domcox@12209 27 }