File: ki

package info (click to toggle)
magyarispell 1.2%2Brepack-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,952 kB
  • sloc: sh: 1,032; awk: 404; makefile: 265; sed: 153; lisp: 102
file content (10 lines) | stat: -rwxr-xr-x 329 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
#!/bin/sh
# description: subtract $1 from $2 without sorting
# usage: ki $1 $2
case $# in
[0-1]) echo "description: subtract file1 from file2
usage: ki file1 file2"; exit 0;;
esac
cat $2 | awk "BEGIN{while ((getline var < \"$1\") > 0) w[var]=1}
w[\$0]!=1{print\$0}" >/tmp/ki$$ && mv /tmp/ki$$ $2
[ -f /tmp/ki$$ ] && rm /tmp/ki$$