A=(aaa bbb ccc) cat abc.txt | awk \'{ print $1, ${A[$1]} }\'
I want to index an array element based on the $1, but the code above is not correc
If you are going to be hard-coding the A array, you can just initialize it in awk
A
awk
awk 'BEGIN{A[0]="aaa";A[1]="bbb"}{ print $1, A[$1] }' abc.txt