#!/bin/sh # # findlines - find lines from one file in another file # Michael Ward # # $Id$ . "$HOME/bin/functions" invert= while getopts "v" flag do case $flag in v) # print lines NOT in the compare file invert=1 ;; esac done shift $((OPTIND - 1)) if test $# -ne 2 then error "Usage: findlines [-v] " exit 2 fi src="$1" cmp="$2" while read line do if test -n "$invert" then fgrep -q -x $flags "$line" "$cmp" || echo "$line" else fgrep -x $flags "$line" "$cmp" fi done < "$src"