awk引用系统变量
日期:2011-11-15
点击:98
来源: huoxiubo
分享至:
awk 引用shell变量的几种方法
一、-v选项
[root@159 shell]# a=test
[root@159 shell]# awk -v b="$a" 'BEGIN{print b}'
test
二、双引号中加单引号
[root@159 shell]# awk 'BEGIN{print "'$a'"}'
hhhh
三、单引号中加双引号
[root@159 shell]# awk 'BEGIN{print '\"$a\"'}'
hhhh