Search code examples
unixawksedsolaris

How to replace "/" with "\ /" in unix-solaris


For example : 3/12/1991 should get converted to 3\/12\/1991.

That is, I want to replace / with \/ [slash with backslash and slash].


Solution

  • sed 's|/|\\/|g', maybe?

    echo 3/12/1991 | sed 's|/|\\/|g'
    3\/12\/1991