loose the quotes, they force literal.
sed s/$1/$2/g $3 > $3.tmp

steve

-----Original Message-----
From: Shaw, Marco [mailto:[EMAIL PROTECTED]]
Sent: 14 June 2002 15:29
To: '[EMAIL PROTECTED]'
Subject: sed scripting


I'm trying to use sed to do something like:

# sh function.sh "something = yes" "something = no" file
# cat function.sh
#!/bin/sh
# this is function.sh

function ( ) {
sed 's/$1/$2/g' $3 > $3.tmp
}

function
# end of function.sh

I want to give 3 arguments to the script function.sh, then have these
arguments be "applied" to the function and run within sed.

It doesn't seem to like the $# strings within SED.

Am I missing something or is this not do-able in SED?  I tried escaping $
and using quotes without luck.

Thanks,
Marco



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to