read input while read line; do case $line in $input) echo ;; # or not, if you want the newline gone, too *) echo "$line";; esac done <file