Last active
October 4, 2019 00:22
-
-
Save oliverralbertini/add73c17e02e39c59623d1df145992c9 to your computer and use it in GitHub Desktop.
merge krb5.conf files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
block_length = 0 | |
block_has_diff = 0 | |
} | |
{ | |
if ( $0 ~ /{.*{/ || block_length ) { | |
if ( $1 != $2 ) | |
block_has_diff++ | |
block1[block_length] = $1 | |
block2[block_length] = $2 | |
block_length++ | |
} else if ($1 == $2 || $1 ~ /default_realm/) { | |
print $1 | |
} else { | |
print $1 | |
print $2 | |
} | |
if ( $0 ~ /}.*}/ ) { | |
for (i=0; i<block_length-1; i++) | |
print block1[i] | |
print $1 | |
if (block_has_diff) { | |
for (i=0; i<block_length-1; i++) | |
print block2[i] | |
print $2 | |
block_has_diff = 0 | |
} | |
block_length = 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script can be called like this: