[an error occurred while processing this directive]

  • substituting a file location using sed s
    By : Nina Howlett ( Wed Mar 19 06:00:27 2003 )

    How can I substitute a string containing a file location using sed?
    I have tried to substitute a default value (DEFAULT_VALUE) in a text file with a variable holding a file location:
    eg: $Location=/usr/bin

    sed "-e s/DEFAULT_VALUE/${Location}/g" < textfile.txt > substitutedtextfile.txt

    sed fails to recognise the path separators in the String holding the locations as anything but substitute parameters. Is there any way I can encapsulate the String holding the path and prevent the following error occuring:

    sed: -e expression #1, char 17: Unknown option to 's'

    but this failed.

    Return to article...[an error occurred while processing this directive]