Trying to change date separator with sed

Hi there

I am trying to convert some date seperators in a large newline delimited file. each line i am interested in has a date in the format 27/05/2009 all I want is to convert the slashes to tildes(~) I have come up with the following code but it does nothing.

 
sed 's/\([0-9]\{2\}\)\/\([0-9]\{2\}\)\/\([0-9]\{4\}\) / \1~\2~\3 /' alltrans.test > at3.txt
 
or
 
sed 's_%([0-9]%{2%}%)%/%([0-9]%{2%}%)%/%([0-9]%{4%}%) _%1~%2~%3_' alltrans.test > at3.txt

Try

sed 's:\/:~:g'

Hey Locks, that will change all occurences of / and unfortunately I need to only change them in the lines that have a date as the complete record. If it might make it any easier the date line is consitently every 19th line

This works fine with my sample input (same as your first sed)

sed 's/\([0-9]\{2\}\)\/\([0-9]\{2\}\)\/\([0-9]\{4\}\)/\1~\2~\3/g' file

Check for space in your sed or give some sample input file

Post the input and the expected output.

Thanks John it was the spaces! The things you miss at 3am. What is the "g" on the end of the string for?