Article
home/blog/Loading

Setting properties in a properites file using bash

To set or update properties in a properties file from a bash script you can use sed

Example SED usage

Given the properties file:

name=John
last=Wiseman

We can then run the command sed:

sed -i -e "s|REGEX|REPLACE|g" ./file

For Example

sed -i -e "s|name=.*|name=Sandtrooper|g" ./file

This will set every name property to Sandtrooper in ./file