Fill placeholders in file in single pass

前端 未结 5 1750
旧时难觅i
旧时难觅i 2021-02-09 23:11

I have a skeleton text file with placeholder strings:

blah blah blah
blah $PLACEHOLDER_1$
blah
$PLACEHOLDER_2$

and so on. Specific \"form\" of

5条回答
  •  甜味超标
    2021-02-09 23:42

    You can still use sed to do the replace in a single pass. You just need to specify all the replacements in one command.

    eg.

    sed -i 's/PLACEHOLDER_1/string 1/g;s/PLACEHOLDER_2/string 2/g' 
    

提交回复
热议问题