awk引用系统变量
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'"}'
test
三、單引號中加雙引號
[root@159 shell]# awk????'BEGIN{print '\"$a\"'}'
test
一、-v選項
[root@159 shell]# a=test
[root@159 shell]# awk -v b="$a" 'BEGIN{print b}'
test
二、雙引號中加單引號
[root@159 shell]# awk????'BEGIN{print "'$a'"}'
test
三、單引號中加雙引號
[root@159 shell]# awk????'BEGIN{print '\"$a\"'}'
test
轉載于:https://blog.51cto.com/huoxiubo/714267
總結
- 上一篇: [转载] 百科全说——栾加芹:你适合这些
- 下一篇: Windows Server 2008终