I'm building a script that will take an array of values in a file (broken up by commas) and covert the array into a list of values, each preceded by variable identifier.
Here is the script logic as I see it:
Load file of arrayed values [FILENAME].csv
initiate script variables # don't need help with this area
update the value identifier text that's in the form of a string # don't need help with this area
Use Sed to
find the first comma in the loaded file
replace the comma with a "new line character" then followed by the value identifier string
end Sed command
Save the Sed command exiting status to a variable (was the Sed command successful or did it fail)
Encompass the operation in a while statement that says continue searching for and replacing commas while the Sed command is ending successfully. I.E. repeat the process there are still commas that need to be found and replaced. Otherwise end script
At this point I'm a total noob when it comes to Sed.
Could anyone help me develop a Sed command and a logic structure (the while statement) that will do what I've described above?