Variable substitution in sed with pathname
red_valsen_at_yahoo.com
Date: 01/14/05
- Next message: msskyejohnson_at_hotmail.com: "Direct Printing with TCP/IP"
- Previous message: Stephane CHAZELAS: "Re: QOUTES"
- Next in thread: Ed Morton: "Re: Variable substitution in sed with pathname"
- Reply: Ed Morton: "Re: Variable substitution in sed with pathname"
- Reply: sharma__r_at_hotmail.com: "Re: Variable substitution in sed with pathname"
- Reply: Will Renkel: "RE: Variable substitution in sed with pathname"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 14 Jan 2005 08:34:27 -0800
How do I do a simple variable substitution in sed with a value that is
a pathname ie includes slashes?
This fails in ksh and bash:
VPATH=/foo/bar
sed -e "s/EXECPATH=.*/EXECPATH=${VPATH}/"<configfile >tmpconfigfile
with error message (in bash):
sed: -e expression #1, char ##: Unknown option to `s'
-- where ## is a column number. The failure occurs whether 1)the
literal for VPATH is quoted with single/double quotes 2) whether
${VPATH} is quoted with escaped single/double quotes. The statment
cannot be enclosed in single quotes since this would entirely prevent
the substitution. The only way to make it work is to modify the
literal variable by escaping the slashes -- which is unacceptable since
this fouls other uses of the variable.
- Next message: msskyejohnson_at_hotmail.com: "Direct Printing with TCP/IP"
- Previous message: Stephane CHAZELAS: "Re: QOUTES"
- Next in thread: Ed Morton: "Re: Variable substitution in sed with pathname"
- Reply: Ed Morton: "Re: Variable substitution in sed with pathname"
- Reply: sharma__r_at_hotmail.com: "Re: Variable substitution in sed with pathname"
- Reply: Will Renkel: "RE: Variable substitution in sed with pathname"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|