cut a line into different fields based on identifiers

cat fileanme.txt
custom1=, custom2=, userPulseId=3005, accountPolicyId=1, custom3=, custom4=, homeLocationId=0, 

i need to make the fields appear in next line based on identifier (,) ie comma

so output should read

cat fileanme.txt
custom1=,
 custom2=, 
userPulseId=3005,
 accountPolicyId=1,
 custom3=, 
custom4=, 
homeLocationId=0, 

any help is deeply appreciated

awk  '{for(i=1; i<=NF; i++) {printf("%s\n", $i) }' infile 

This assumes there is a space or newline after each comma.

sed 's/,/,\n/g' fileanme.txt

The above command will filter based on comma(,) and enters an empty line in the next line.

This would leave an extra empty line at the end of the file...

cat fileanme.txt | sed 's/,/,\n/g'  |  sed '/^$/d'

Check with above command now

Appriciate that, but cat filename is not an ideal way to use file for editing.. it will cause an issue when file size is huge.. also since you are using 2 sed it has to pass through the file twice again an issue if file is huge...

Yes!! You are correct. In case of huge file we can use 'awk' command it works much faster than 'sed'.

Neither awk nor sed are replacements for cat.

The point is that cat is useless here -- nothing ever needs cat's help to read a file.

awk 'NF>0{print $0","}' RS=, filename