Thank you for your answer at https://stackoverflow.com/questions/71080087
@RavinderSingh13
In questions/71080087, I compared two files by the field delimiter.
one more question... I want to ask a more detailed question
This is a list of file systems provided by each of the two servers.
cat volume1.txt (by server1)
/ 80G xfs /dev/mapper/rootvg-lv_root
/boot 1014M xfs /dev/sda2
/boot/efi 500M vfat /dev/sda1
/swlogs 10G xfs /dev/mapper/datavg-lv_swlogs
# cat volume2.txt (by server2)
/ 33G xfs /dev/mapper/rhel-root
/boot/efi 599M vfat /dev/sda1
/boot 1014M xfs /dev/sda2
Is it possible to output as below? (order of the lines doesn't matter)
volume1.txt volume2.txt
/ 80G xfs /dev/mapper/rootvg-lv_root : [ NotMatch ] : / 33G xfs /dev/mapper/rhel-root
/boot 1014M xfs /dev/sda2 : [ OK ] :
/boot/efi 500M vfat /dev/sda1 : [ NotMatch ] : /boot/efi 599M vfat /dev/sda1
/swlogs 10G xfs /dev/mapper/datavg-lv_swlogs : [ NotExist ] :
my work...
FOOD1=`cat ./food1.txt`
FOOD2=`cat ./food2.txt`
echo "$FOOD1" | while read ACCOUNT
do
grep -w $ACCOUNT ./food2.txt >/dev/null 2>&1
if [ $? -eq 0 ] ; then
echo "-----[ OK ] : $ACCOUNT"
else
echo "-----[ WARN ] : $ACCOUNT"
fi
done
If you don't understand my question please tell me.