How do I place commas between fields?
Input data
12123 \'QA test case 1\' \'QA environment\'
12234 \'UAT test case 1\' \'UAT environment\'
>
The solution is to walk through every character in the record (while read -n 1
), joining every non-space character as one element value and all characters enclosed in single quotes (or quoted single quotes in your option (\'
). Everytime you complete a unit (reaching space or newline), append it to an array. When encountering a newline or reaching EOF, end the record and print the record array in your format. The cycle begins again with record array cleared.
Want a source code? Show me your work first. :)