ksh to compare alphanumeric values from 2 files

Hi there,

I want to compare 2nd column which are alphanumeric values from each of the 2 files i.e.,lspv_pre.out and lspv_post.out , if found echo some message.

lspv_pre.out

hdisk0          00c39eaa451144dd                    rootvg          active
hdisk1          00c39eaa45223322                    testvg1        active
hdisk2          00c39eae321733d8                    testvg1        active
hdisk3          00c39eaa121273d8                    testvg1        active
hdisk4          00c39eaa340989e3                    testvg2        active
hdisk5          00c39eaa57821b1a                    testvg2        active
hdisk6          00c39eaa68dd9313                    testvg2        active

lspv_post.out

hdisk0          00c39eaa451144dd                    rootvg          active
hdisk1          00c39eaa45223322                    None        None
hdisk4          00c39eae321733d8                    None        None
hdisk5          00c39eaa121273d8                    None        None
hdisk6          00c39eaa340989e3                    None        None
hdisk7          00c39eaa57821b1a                    None        None
hdisk9          00c39eaa68dd9313                    None        None

Any help is much appreciated...

Thanks
MBAK

#!/bin/ksh

exec 5<lspv_pre.out
exec 6<lspv_post.out

LINE=0
while true
do
        LINE=$((LINE+1))
        read A1 B1 C1 <&5 || break
        read A2 B2 C2 <&6 || break

        [ "$B1" = "$B2" ] || echo "Line $LINE, $B1 != $B2"
done

exec 5<&-
exec 6<&-

Thanks Corona688 for prompt response..your script compares line by line which is ok but what if the 2nd column in lspv_post.out jumbled up like below...

hdisk0          00c39eaa451144dd                    rootvg          active
hdisk7          00c39eaa57821b1a                    None        None
hdisk5          00c39eaa121273d8                    None        None
hdisk9          00c39eaa68dd9313                    None        None
hdisk4          00c39eae321733d8                    None        None
hdisk1          00c39eaa45223322                    None        None
hdisk6          00c39eaa340989e3                    None        None

Then it might have been helpful to reflect that in your test data.

awk 'BEGIN { while(getline <"lspv_pre.out") LINE[$1]=$2 }
{
        if(LINE[$1] != $2) printf("Line %d, %s != %s\n", NR, LINE[$1], $2);
}' < lspv_post.out