Replace a filename with full path using sed

hi,

i need to replace a line a file with a new raw device location..
original file..

/opt/sybase/ASE1502/ASE-15_0/bin/dataserver \
-d/data/TST_AKS1/sybdevices/master.dat \
-e/logs/sybase/TST_AKS1/SFO_TST_AKS1.log \
-c/apps/sybase/ASE1502/ASE-15_0/TST_AKS1.cfg \
-M/apps/sybase/ASE1502/ASE-15_0 \

i need to change -d value to /dev/vx/rdsk/sandg-100/raw200-01
so new file should look like

/opt/sybase/ASE1502/ASE-15_0/bin/dataserver \
-d/dev/vx/rdsk/sandg-100/raw200-01 \
-e/logs/sybase/TST_AKS1/SFO_TST_AKS1.log \
-c/apps/sybase/ASE1502/ASE-15_0/TST_AKS1.cfg \
-M/apps/sybase/ASE1502/ASE-15_0 \

i tried using sed
i set the new file name in a varaiable

export mydev=/dev/vx/rdsk/sandg-100/raw200-01
sed s/^-d.*/$mydev/g

it didn't work..

any idea how to make work, it would be nice if i can use a shell variable inside sed command to replace the value...

i even tried awk, but didn't work either

awk '{ if ($1 ~= "-d") print $0 else print $mydevice }' <filename

thanks
AK

Use a different delimiter when you have slashes in one of the fields:

mydev=/dev/vx/rdsk/sandg-100/raw200-01
sed "s|^-d.*|$mydev|g"
awk -v mydev="$mydev" '/^-d/ { print mydev; next } { print }' filename

Very simple to use SED here:

sed '/-d\/data/c\
-d/dev/vx/rdsk/sandg-100/raw200-01 \\
' filename