Mercurial > hg > cc > cirrus_home
annotate bin/intersection @ 140:0a447db5cf1c
move to ec164.guest
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Tue, 19 Oct 2021 12:55:30 +0000 |
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 |