How to merge two properties file, using shell scripts for example : – if i have two properties file like
first.properties
/test/file="anish"
/test/version=3.0
second.properties
/test/author=nath
/test/version=2.0
if i merge first.properties over second.properties then common existing property should taken from the first.properties so my output should look like
final.properties
/test/file="anish"
/test/version=3.0
/test/author=nath
Another way:
The input to this awk is the content of first file followed by second file.
!a[$1]++prints only the first occurence of a particular key, hence removing duplicates apparing in the 2nd file.