用双引号引起来 [英] Enclose within double quotes

查看:100
本文介绍了用双引号引起来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的命令,但是我需要将每条输出行都用双引号("...")括起来.如何修改此命令?

I have command like this, but I need each output line to be enclosed within double quotes ("..."). How to modify this command?

awk '{ for (i = 2; i <= NF; i++) { printf("%s ", $i); } printf("\n") }' all.txt > result.txt

推荐答案

printf("\"")打印出双引号,并在循环前后添加它:

printf("\"") prints out a double quote, Add it before and after the loop:

awk '{ printf("\""); for (i = 2; i <= NF; i++) { printf("%s ", $i); } printf("\"\n") }' t.txt

这篇关于用双引号引起来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆