Convert comma seperated file to line seperated.

Hi,

I have data like this.
1,2,3,4

Output required:
1
2
3
4

I am trying to use tr function but getting error.
Help is appreciated.

tr -s ','  '\n' < inputfile >  outputfile

Don't forget to put quotes around \n.
Something like

#!/bin/sh
cat $1 | tr , "\n"

will translate all commas in the file to newlines.

$ echo 1,2,3,4 | awk 1 RS=,

or

echo 1,2,3,4 | sed 's/,/\n/g'

> echo 1,2,3,4 | sed 's/,/\n/g'
output :1n2n3n4
&
> echo 1,2,3,4 | awk 1 RS=,
output
awk: syntax error near line 1
awk: bailing out near line 1

both not work suggest please

$ echo 1,2,3,4 | nawk 1 RS=,
1
2
3
4
$ echo 1,2,3,4 | tr , "\n"
1
2
3
4
IFS=,
for i in ` echo 1,2,3,4`; do   echo $i; done