Sunday, 21 June 2020

Another way:
$ awk -F= '!a[$1]++' first.properties second.properties
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.

from : https://stackoverflow.com/questions/14017577/merge-two-properties-file-using-shell-scripts

No comments:

Post a Comment

How to check if a file contains a specific string using Bash

 In case if you want to check whether file does not contain a specific string, you can do it as follows. if ! grep -q SomeString "$File...