Reputation: 469
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
Upvotes: 1
Views: 161
Reputation: 122383
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
Upvotes: 2