给定template.txt:
The number is ${i} The word is ${word}
我们只需要说:
sed -e "s/\${i}/1/" -e "s/\${word}/dog/" template.txt
感谢Jonathan Leffler提示将多个-e参数传递给同一个sed调用。