Passing Array to awk

view full story

http://www.unix.com – I'm trying to use the following command: Code: awk -v array1=${array1[@]} -f "filename.awk" input.txt Then within filename.awk I want to access array1[n]. However, awk mistakes array1[2] (the third element of the array) for the input file. How I can pass awk this array? It also appears that awk scripts can't understand ":-" or ${#var}. Is this correct? (HowTos)