Something like:
cat template.txt | ruby -e 'puts STDIN.read.sub("%placeholder%", IO.read("content.txt"))' > output.txt
Or:
ed template.txt <<EOF
/%placeholder%/d
.r content.txt
w output.txt
EOF
Any alternatives?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The first command searches for
$xxxthen prints out the contents ofcontent.txt. The second one deletes$xxx.You can also use a multi-line command, which would be more readable when used in scripts.