Example input:
SERVER_NAME=server1
PROFILE_NAME=profile1
...
Example output:
SERVER_NAME=server3
PROFILE_NAME=profile3
...
This file will use in applicationContext.xml. I’ve tried
<copy file="${web.dir}/jexamples.css_tpl"
tofile="${web.dir}/jexamples.css" >
<filterchain>
<replacetokens>
<token key="SERVER_NAME" value="server2"/>
<token key="PROFILE_NAME" value="profi"/>
</replacetokens>
</filterchain>
</copy>
but it doesn’t work.
Your
filterchainis ok, but your source file should look like this:This code (as provided by you)
replaces the tokens and gives you
If you want to keep your original file as you have it now, one way would be to use
replaceregex:This would replace every line starting with
SERVER_NAME=bySERVER_NAME=server2(same forPROFILE_NAME=). This will return get you the output you described.[ \t]*is to ignore whitespace.