Wednesday, May 23, 2012

array variable in awk

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 correct in awk syntax. Could someone help? Thanks!





No comments:

Post a Comment