How do I place commas between fields?
Input data
12123 \'QA test case 1\' \'QA environment\'
12234 \'UAT test case 1\' \'UAT environment\'
>
Try this awk:
awk -F" '" '{ print $1, $2, $3 }' OFS=", '" data
or using a BEGIN
block:
awk -F" '" 'BEGIN {OFS="," FS} { print $1, $2, $3 }' data
In either case, the FS
is being set to '
(space + "'") and OFS
is being set to "," + '
. It's based on the assumption '
is a validly unique field separator and all input data is formatted/arranged as in the question.