4.43. How do I replace "C:\SOME\DOS\PATH" in a substitution?
For MS-DOS users, every backslash must be doubled. Thus, to replace
"C:\SOME\DOS\PATH" with "D:\MY\NEW\PATH":
sed "s|C:\\SOME\\DOS\\PATH|D:\\MY\\NEW\\PATH|g" infile >outfile
Remember that DOS pathnames are not case sensitive and can appear
in upper or lower case in the input file. If this concerns you, use
a version of sed which can ignore case when matching (gsed, ssed,
:: sample MS-DOS batch file to alter path statements
:: requires GNU sed with the /i flag for s///
gsed "s|%old%|%new%|gi" infile >outfile
:: sedmod -i "s|%old%|%new%|g" infile >outfile
Also, remember that under Windows long filenames may be stored in
two formats: e.g., as "C:\Program Files" or as "C:\PROGRA~1".