SED to convert ~ in a file to newline

Hi,

I have a .txt file which has a tilde(~) in it.
All that I want is to break into a newline whenever there is an occurence of '~'.
I have tried SED to do that but I could not succeed.

I would appreciate if I can get a shell script(ksh) for this problem real quick.

Thanks in advance.

-Raj.

one way:

awk 'BEGIN{FS="~" ;OFS="\n"} {$1=$1}1' file

or another:

tr '~' '\n' < file

Thanks dude.
I think 'tr' is the better way of doing it.

Did u try this in sed?

sed 's/~/\n/g' filename

Not all version of sed support \n

sed "s/~/\\
/g" filename

The sed in FreeBSD (tcsh by default) is one such version.

Said sed doesn't support \n on the command line.