1

Compare file to array, replace with corresponding second array

view story
linux-howto

http://www.unix.com – ok, so here is the issue, I have 2 arrays. I need to be able to create a loop that will find ${ARRAY1[1] in the text doc, and replace it with ${ARRAY2[1] then write the results. I already have that working. The problem is, I need it to do that same result across however many items are in the 2 arrays (they will always be an equal # and will always match instances in the target text file) So, here is what I have so far Quote: LOOP=${#READ[@]} for i in $(eval echo {0..$LOOP}) do sed -e 's/'${ARRAY1[$i]}'/'${ARRAY2[$i]}''/'g' ${FILE}.txt done (HowTos)