Portable Cygwin: replacing drivename in a text file
Wed Nov 24 13:32:00 GMT 2010
Running Cygwin off a portable USB stick.
Different host machines typically allocate a different drivename to the
Previous use, say it was J:. A not-quite-portable application needed a
settings.ini file built with many occurrences of the string
j:\usr\local\bin. The file was built and saved.
Current use: now it's K:.
I could re-configure settings.ini with
sed -i 's/j:/k:/g' settings.ini
but in general I don't know (and don't want to bother with) what the
drivename labels were, or are. Something like
sed -i 's/.:\\/ replacementstring /g' settings.ini
will in fact be sufficiently strong to make the change olddriveletter:
to newdriveletter: where, and only where, I need it, but experiment as I
replacementstring = cygpath -w
replacementstring = `cygpath -w`
and other variations, I can't get the syntax quite right.
Can anybody help, please? Thank you very much.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin