I am attempting to write a script to pull all words separated by commas on a new line from a text file that contains the following:
HELLO,DOCTOR,NAME,CONTINUE,YESTERDAY,TOMORROW
I am attempting to write a script to pull all words separated by commas on a new line from a text file that contains the following:
HELLO,DOCTOR,NAME,CONTINUE,YESTERDAY,TOMORROW
Demonstrating how to apply the individual linked-duplicate questions, each of which addresses a separate element of this question:
IFS=, read -r -a words <file # from duplicate "How do I split a string on a delimiter?"
printf '%s\n' "${words[@]}" # from duplicate "Print array elements on separate lines"
Similarly, the approach given in How do I replace : characters with newline? works just as well with ,
as with :
--
tr ',' '\n' <file