Sometime back I had explained how to find the difference and common lines in two files, Using that giving you 2 simple (very simple) scripts
1. Find out the missing lines between two files
cat diff.sh #!/bin/bash if [ $# -eq 0 ];then echo "No arguemnts given; Usage : ./diff file2 file1" exit 1 fi echo "Lines exist in $2 and not in $1 are :" grep -Fxv -f $1 $2
2. Find out the common lines between two files
cat common.sh #!/bin/bash if [ $# -eq 0 ];then echo "No arguments given; Usage : ./common file1 file2" exit 1 fi echo "Common files in $1 and $2 are :" awk 'NR==FNR{a[$1]++;next} a[$1] ' $1 $2
Enjoy 🙂