How do I place commas between fields?
Input data
12123 \'QA test case 1\' \'QA environment\' 12234 \'UAT test case 1\' \'UAT environment\' >
12123 \'QA test case 1\' \'QA environment\' 12234 \'UAT test case 1\' \'UAT environment\'
Another option is to use a CSV parser:
ruby -rcsv -ne ' puts CSV.generate_line( CSV.parse_line($_.strip, {:col_sep => " ", :quote_char => "'\''"} ), {:force_quotes => 1}) ' file
"12123","QA test case 1","QA environment" "12234","UAT test case 1","UAT environment"