[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OT: sed help
On Tue, Jun 04, 2002 at 03:17:18PM -0700, James A. Peltier wrote:
> sorry for this OT question regarding sed.
> I'm trying to take command line user input and pipe it to sed
> for parsing. currently i have this
> [joshua:] vi test
> echo $VALUE1 $VALUE2 > text.tmp
> sed 's/$VALUE1/$VALUE2/' text.tmp > textfile
> for some reason this doesn't work when I try
> [joshua:] sh test test1 test2
> any ideas why? I'm certainly no sed expert as many can see.
> What would be the easiest way to implement this?
You're using the worng quotes. Variable interpolation only happens
with double quotes, not single. Compare:
$ echo $FOO
$ echo "FOO is $FOO"
FOO is bar
$ echo 'FOO is $FOO'
FOO is $FOO
And, yes, there are much better places to ask these questions. You
might start with:
You should also read sh (1)--this is pretty basic stuff, all
covered in the man page and any other (Bourn-style) shell
[demime 0.98d removed an attachment of type application/pgp-signature]