I have the below script to find missing items from fileA compared to fileB and write to fileC
script.sh fileA fileB fileC
script.sh:
rm $3
while IFS="" read -r inputline; do
fgrep -q \""$inputline"\" $1
if [ 1 -eq $? ]; then
echo \""$inputline"\" >>$3
fi
done <$2
I see everything in fileB getting dumped to fileC, i'm missing somethig basic. (aix 6, bash)
ps: files have trailing spaces and it matters in comparison
fileB
andfileA
to seainputline
but are you sure that all lines infileA
have quotes? – Costas Mar 27 at 21:28if ! grep -Fq "$inputline" $1 ; then
– Costas Mar 27 at 22:02