Q:

replace properties in a properties file by using GNU tools

is there an easy way to accomplish ant expandproperties functionality in Makefiles?, an example follows:
Given the three files:
File main.properties
principal.name=John

File 1.properties
name=${principal.name}

File 2.xml
<properties name="${principal.name}"/>

I'm pursuing to replace all appareances of principal.name in files 1.properties and 2.xml with John, i should use GNU tools for i intend to incorporate it in a Makefile

A:

Yep, this is doable.  I'm doing it here by using awk to construct a sed script which does the substitution:
cat main.properties | awk -F= '{print "s/\\${" $1 "}/" $2 "/g"}' | sed -f - 1.properties

