I need to create a text file where parts of it should be replaced by any arbitrary path. I wanted to do that by copying a template file and then replace a special pattern, e.g. ${MY_PATH} with the arbitrary path (I hope, no quoting is needed). How to do that replacing part (the sed-examples I saw so far seemed to be problematic because of the arbitrary path).
| |||
|
feedback
|
|
The replacement doesn't need much quoting: only backslashes and the regexp separator. For convenience, the latter can often be chosen arbitrarily - instead of s/.../.../ one could, in many programs, say s|...|...| or similar. Assuming the path is
Or if you are not afraid of other languages, you could use:
(Not sure I got the sample right, but you get the idea.) | |||
|
feedback
|