[plug] Sed regex help

ryan at is.as.geeky.as ryan at is.as.geeky.as
Wed Jan 29 16:43:30 WST 2003


On Wed, 2003-01-29 at 16:43, Brad Campbell wrote:
> G'day all,
> I have a script where I need to convert the "\" in dos filenames to "/" 
> suitable for feeding to basename.
> 
> Lets say
> 
> export DOC="C:\BLAH\BLAH\FRED.DOC"
> and I want to convert this to C:/BLAH/BLAH/FRED.DOC
> 
> Now on the command line
> echo $DOC | sed s/\\\\/\//g
> gives me the desired output, but in a bash script
> DOC2=`echo $DOC | sed s/\\\\/\//g`
> 

Put single quotes around the sed's food:

DOC2=`echo $DOC | sed 's/\\\\/\//g'`

Ryan



More information about the plug mailing list