awk 根据外部变量匹配某一域值

shell>> i='a'

awk '$1 ~ /'$i'/ {print $0}' test.txt

 

awk中,变量 增加单引号即可

posted @ 2017-05-15 15:56  jackchen007  阅读(1756)  评论(0编辑  收藏  举报