[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Clueless with sed

On 06-Jul-2002 Joop Stakenborg wrote:
> I am trying to get a sed script to behave nicely.....
> In a file (called 'config') with a line like:
>      DEVEL_PREFIX = _ENVPATH_/$(TARGET_ARCH)-linux-uclibc
> I would like to replace _ENVPATH_ with the current path, with the following 
> line: BASEDIR=`pwd`; sed 's/_ENVPATH_/$BASEDIR/g' config
> Here is the result:
>      DEVEL_PREFIX = $BASEDIR/$(TARGET_ARCH)-linux-uclibc
> Anyone have more experience with sed than I do?

you used single quotes.  In shell '$foo' means exactly dollar sign f o o.  Use
"$foo" and the variable will be interpreted.

$ echo 'NAME said hi' | sed -e "s/NAME/$CVS_FULLNAME/"
Sean 'Shaleh' Perry said hi
$ echo 'NAME said hi' | sed -e 's/NAME/$CVS_FULLNAME/'

To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Reply to: