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.
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.
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