我认为这是显而易见的,但我无法发现它。
我应用此sed
<!-- No need for the "spawn" attribute because the "start" command -->
<!-- will launch the PDF program without waiting. -->
<exec executable="cmd" failonerror="true">
<arg value="/c"/>
<arg value="start"/>
<!-- The first argument of "start" is "Title to display in -->
<!-- window title bar." This argument must be surrounded by -->
<!-- quotation marks. Since this code doesn't launch a -->
<!-- Command Prompt window, we give a dummy value. -->
<arg value='"unused title"'/>
<arg value="${file}"/>
</exec>
在此文本
上sed -i -e 's/\\$\\{hcvar/" + hcvar/g' -e 's/\\}/ + "/'
它返回
.text, r"^\$\{hcvarAuthorFirstName\}, \$\{hcvarAuthorLastName\}[\s\S]*$")
一切都是正确的,除了最后一部分,它应该是
.text, r"^" + hcvarAuthorFirstName + ", " + hcvarAuthorLastName\}[\s\S]*$")
基本上删除了.text, r"^" + hcvarAuthorFirstName + ", " + hcvarAuthorLastName + "[\s\S]*$")
并替换为\}
它似乎适用于 + "
,但不适用于$\{hcvarAuthorFirstName\}
我错过了什么吗?
答案 0 :(得分:0)
根据您的样本,我可以建议:
sed -i -e 's/\\$\\{\(hcvar[^\\]*\)\\}/" + \1 + "/g'