I have two files : filea
and fileb
which I don't want to sort (so I can't use comm
).
filea fileb
cat cat
dog elephant
cat snake
rabbit pony
If the content of filea
is same as that of fileb
then display what is in fileb
, if the contents of files are different and file2 contains elephant then display ele
, if snake, then display sna
, if pony then display pon
.
I tried using cmp
:
if cmp -s filea fileb
then echo $"fileb"
fi
but it didn't display anything. I want the output to be in a column in a third file.