#!/bin/sh
# usp-bez.sh
# datum: 19.10.2009 
# autor: neven jovanović
# from: http://www.linuxforums.org/forum/linux-programming-scripting/151839-compare-two-lists-without-grep.html
#--------
# Compare list of words in $1 with $2, 
# print the words in $1, but not in $2 to $3
#--------
# Syntax: ./usp-bez.sh foo foo.b foo.c

echo "Uspoređujem $1 i $2, različite riječi u $3.\n"
for i in `cat $1` ; do
if grep -wq "$i" $2 ; then
echo "$i"
else
echo "$i" >> $3
fi
done
#-------- end of usp-bez.sh