I tried to input data for awk from an array:
awk -v var="${A[*]}" 'BEGIN{split(var,list,"\n"); for (i=1;i<=length(list);i++) print list[i]}'
Also using awk to find duplicates between files:
filecnt=$(find "${pmdir}" -type f)
awk -v n=filecnt '{a[$0]++}END{for (i in a)if (a[i]>1){print i, a[i];}}' $filecnt >> ${outputfile}
But I had hard time to find out how to do it if awk takes an array as its input. something like:
awk -v var="${A[*]}" '{var[$0]++}END{for (i in var)if (var[i]>1){print i, var[i];}}'
A is a column data reading from a file:
for i in $( awk -F ',' '{ print $1; }' "${ifile}" )
do
A[$j]=$i
#echo "${A[$j]}"
j=$((j+1))
done
example of A is
0x10000
0x11000
0x01100
0x00010
0x11000
0x00010
0x00010
The output is wanted:
0x11000 2
0x00010 3
Thanks for your suggestions.