Kok Kok wrote: > Hi all > > I have question how to replace words using sed > > ./script 61.100 192.168 > > The script is > #!/bin/sh > sed -e 's/$2/$1/g' file > newfile > > The problem is 192.168 can't replace 61.100 in the > newfile
The single quotes prevent interpolation, the $... are not treated as variables by the shell. Use double quotes instead: sed -e "s/$2/$1/g" file > newfile -- Dean C. Strik Eindhoven University of Technology [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ipnet6.org/ "This isn't right. This isn't even wrong." -- Wolfgang Pauli To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-questions" in the body of the message