Mercurial > hg > cc > cirrus_home
annotate bin/intersection @ 191:b5904d0bdfd4
orig, more or less
| author | Henry S. Thompson <ht@inf.ed.ac.uk> |
|---|---|
| date | Wed, 25 Sep 2024 09:49:12 +0100 |
| parents | 464d2dfb99c9 |
| children |
| rev | line source |
|---|---|
| 88 | 1 #!/bin/sh |
| 2 # Output intersection (or, with -d, difference) of two files, line by line | |
| 3 # No detection or special treatment of duplicates | |
| 4 # Usage: intersection [-d] s1 s2 | |
| 5 # In the case of difference, which is ordered, interpretation is s1 - s2 | |
| 6 if [ "$1" = "-?" ] | |
| 7 then | |
| 8 echo "Usage: intersection [-d] s1 s2" | |
| 9 exit 1 | |
| 10 fi | |
| 11 if [ "$1" = "-d" ] | |
| 12 then | |
| 13 shift | |
| 14 fgrep -x -v -f "$2" "$1" | |
| 15 else | |
| 16 fgrep -x -f "$1" "$2" | |
| 17 exit 0 | |
| 18 fi | |
| 19 |
