Trying to replace MAC Addresses in a flat file. In the code below, the addresses are successfully mapping to the array. I've tried to use a counter to increment the array index on each loop, with the intent of replacing the address on line n with the nth address in the array.
The sed block effectively replaces the addresses, but only with the entry at array index 0.
mapfile -t Arr1 < <(text processing commands)
i=0
while read line
do
sed -E "s/([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}/${Arr1[$i]}/"
((i++))
done < $macFile