answered 2015-09-01 06:09:57 -0500
look at using a template for your file, an erb script would manage this nicely.
alternatively could use a tool called augeus.
for templating have a look at:
templates
and for augeas
augeas