Comma separated values to individual lines

My OS : RHEL 6.7

I have a text file with comma separated values like below

$ cat testString.txt
'JOHN' , 'KEITH' , 'NEWMAN' , 'URSULA' , 'ARIANNA' , 'CHENG', . . . .

I want these values to appear like below

'JOHN' , 
'KEITH' , 
'NEWMAN' , 
'URSULA' , 
'ARIANNA' , 
'CHENG', 
.
.
<not including a longing for readability reasons >

How can I do this ?

Terminology question:
What is term used for changing values in line (Horizontal) to vertical position. Is it called pivoting or something ? Just out of curiosity.

Hello kraljic,

Let's say we have following Input_file.

cat  Input_file
'JOHN' , 'KEITH' , 'NEWMAN' , 'URSULA' , 'ARIANNA' , 'CHENG'

Then following code could help you in same.

awk '{gsub(/, /,"&\n",$0);print}'   Input_file

Output will be as follows.

'JOHN' ,
'KEITH' ,
'NEWMAN' ,
'URSULA' ,
'ARIANNA' ,
'CHENG'

If above doesn't meet your requirement then request you to please mention more sample output into your post(with code tags) and with all the conditions which you require for it too.

Thanks,
R. Singh

Try

awk 1 RS=, file
'JOHN' 
 'KEITH' 
 'NEWMAN' 
 'URSULA' 
 'ARIANNA' 
 'CHENG' 

If you need to get rid of the (inconsistently used) spaces, additional measures must be taken. e.g.

awk 1 RS=" *, *" file
1 Like

or

sed 's/ *, */,\n/g' file
1 Like

bit shorter:

sed -e 's/, /&\n/g' file
1 Like