I created two arrays or files that I want to compare. I want the output to show what's different from fileA vs. fileB and what's different from fileB vs. fileA. I would like this be done without using temp files. Here is what I have coded thus far:
#!/usr/bin/ksh
typeset -i x=0
typeset -i y=0
FSTAB_LST=`cat /etc/fstab | sort | awk '{ print $1 }' |
sed -e "/^$/d" -e "/^#/d" -e "s|/.../||g" -e "s|/dev/||g" -e "s|..ss:..../||g" -e "/vgswap/d"`
BDF_LST=`bdf | tail +2 | sort | awk '{ print $1 }' |
sed -e "/^[0-9]/d" -e "s|/.../||g" -e "/^$/d" -e "s|..ss:..../||g"`
if [ "$FSTAB_LST" = "$BDF_LST" ]
then
print "The BDF & FSTAB Lists Match"
exit
else
print "***** BDF & FSTAB Error Listing"
for F_CNT in $FSTAB_LST
do
FSTAB_CNT[y]=$F_CNT
y=y+1
done
for B_CNT in $BDF_LST
do
BDF_CNT[x]=$B_CNT
x=x+1
done
fi
#!/usr/bin/ksh
typeset -i x=0
typeset -i y=0
FSTAB_LST=`cat /etc/fstab | sort | awk '{ print $1 }' |
sed -e "/^$/d" -e "/^#/d" -e "s|/.../||g" -e "s|/dev/||g" -e "s|..ss:..../||g" -e "/vgswap/d"`
BDF_LST=`bdf | tail +2 | sort | awk '{ print $1 }' |
sed -e "/^[0-9]/d" -e "s|/.../||g" -e "/^$/d" -e "s|..ss:..../||g"`
if [ "$FSTAB_LST" = "$BDF_LST" ]
then
print "The BDF & FSTAB Lists Match"
exit
else
print "***** BDF & FSTAB Error Listing"
for F_CNT in $FSTAB_LST
do
FSTAB_CNT[y]=$F_CNT
y=y+1
done
for B_CNT in $BDF_LST
do
BDF_CNT[x]=$B_CNT
x=x+1
done
fi