Reputation: 991
I'm trying to search and replace " REPLACEME" with the contents of /tmp/dictionary.txt using SED.
I've tried a few other solutions mentioned on stack overflow, however they keep throwing errors: sed: 3: "# REPLACEME
Thank you!
script I'm using:
#!/bin/bash
sed '# <string>REPLACEME</string># {
r /tmp/dictionary.txt
}' /tmp/plaintext.plist > palintext_ammended.plist
Upvotes: 1
Views: 179
Reputation: 58473
This might work for you (GNU sed):
sed -e '/REPLACEME/{s//\n/;P;e cat dict.txt' -e 'D}' plain.txt
Upvotes: 1
Reputation: 785406
This should work:
sed -e '/<string>REPLACEME<\/string>/r /tmp/dictionary.txt' -e '//d' /tmp/plaintext.plist
sed only allows alternative delimiter for s
(substitute) command. With #
it will ignore rest of the command probably treating that as comment.
Upvotes: 2