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/'
$CVS_FULLNAME said hi
To UNSUBSCRIBE, email to email@example.com
with a subject of "unsubscribe". Trouble? Contact firstname.lastname@example.org