Compare Array results

Hi,
In a kshell , i need to compare the results of two array .
each Non-match value should copy to a new array.

For example:

Array one contain the following values:
A
B
C

Array two contain the following values:
C
F
A
E

After comparing this arrays , a new array should be populated with the following values:
F
E

I will appreciate you help
Thank You :confused:

Not sure of the source of those values, but if they are in files then the following will provide your required output.

> cat file82
A
B
C
> cat file83
C
F
A
E
> egrep -vf file82 file83
F
E

Hi joeyg,

The values are not stored in a file, they are stored inside an Array.
I need to compare the arraies values , and create new array based on the unmached values.

Thank Again

As ksh array:

root@isau02:/data/tmp/testfeld> cat ./mach.ksh
#!/usr/bin/ksh

set -A array1 "A" "B" "C"
set -A array2 "C" "F" "A" "E"

NUM_1=`echo ${#array1[*]}`

for ELE2 in ${array2[*]}; do
                Z=0
        for ELE1 in ${array1[*]}; do
                if [[ $ELE1 != $ELE2 ]]; then
                        let Z=$Z+1
                        if [[ $Z = $NUM_1 ]]; then
                                echo $ELE2
                        fi
                fi
        done
done

exit 0
root@isau02:/data/tmp/testfeld> ./mach.ksh
F
E

TBH, I would tend to write the stuff to temp files and use Joeyg's solution.

Hi Zaxxon,
You help was very valueable for me.
I need some extra help :

I need to add the result (e.g : F E) to the first Array.
So, the actual result should be :
A B C F E (the order is not important).

I tried to use set +A as followed but didnt got therewuired results :

root@isau02:/data/tmp/testfeld> cat ./mach.ksh
#!/usr/bin/ksh

set -A array1 "A" "B" "C"
set -A array2 "C" "F" "A" "E"

NUM_1=`echo ${#array1[*]}`

for ELE2 in ${array2[]}; do
Z=0
for ELE1 in ${array1[
]}; do
if [[ $ELE1 != $ELE2 ]]; then
let Z=$Z+1
if [[ $Z = $NUM_1 ]]; then
echo $ELE2
set +array1 $ELE2 ====> the change i added
fi
fi
done
done

exit 0

Thanks Again