linux 中 awk命令如何输出双引号和单引号

 

001、双引号

[root@PC1 test]# ls
a.txt
[root@PC1 test]# cat a.txt
1
2
3
4
5
[root@PC1 test]# awk '{print $0, "\""}' a.txt    ## 输出双引号
1 "
2 "
3 "
4 "
5 "

 

002、单引号

[root@PC1 test]# ls
a.txt
[root@PC1 test]# cat a.txt
1
2
3
4
5
[root@PC1 test]# awk '{print $0, "'\''"}' a.txt    ## 输出单引号
1 '
2 '
3 '
4 '
5 '

 

posted @ 2023-05-12 16:56  小鲨鱼2018  阅读(740)  评论(0编辑  收藏  举报