wok-next view pm-utils/stuff/grep-x.patch @ rev 18188
tokyocabinet: add --enable-off64
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Jul 08 12:20:47 2015 +0200 (2015-07-08) |
parents | |
children |
line source
1 --- functions.in.orig
2 +++ functions.in.new
3 @@ -215,8 +215,22 @@
4 for p in "$@"; do
5 echo "$p" >> "$PARAMETERS.rm"
6 done
7 - # let grep do the dirty work.
8 - grep -vxFf "$PARAMETERS.rm" "$PARAMETERS" > "$PARAMETERS.new"
9 + # let awk do the dirty work.
10 + cat "$PARAMETERS" | awk -v VAR="$(cat "$PARAMETERS.rm")" '
11 + {
12 + del=0
13 + split(VAR,rm)
14 + for(i in rm)
15 + {
16 + if($1==rm[i]){
17 + del++
18 + }
19 + }
20 + if(del==0)
21 + {
22 + print $1
23 + }
24 + }' > "$PARAMETERS.new"
25 fi
26 cp -f "$PARAMETERS.new" "$PARAMETERS"
27 }