Convert / to \

Hi,
In my input variable values are c:/test/sample/
I need to convert it to c:\test\sample
I need to find and replace it
How do I do it?
var_conversion=`"$var_SearchFile" | sed 's/'\'/'/'/g'`
echo ${var_conversion%/*}

My code throws error

hi,
something like this:

echo "c:/test/sample/" | sed -e 's/\//\\/g'

or

var_conversion=`"$var_SearchFile" | sed -e 's/\//\\/g'`
$ echo 'c:/test/sample' | sed 's:/:\\:g'
c:\test\sample
$

just use another separator than the / so you won't need to escape it, only the backslash will keep its special meaning and must be escaped by itself

echo -e "c:/test/sample/" | tr '/' '\\'

Using shell(man bash ("bash") or man ksh ("ksh")) parameter expansion

var='c:/test/sample'
echo ${var//\//\\}
c:\test\sample