this is very short list of my json file:
"slider-client" : {
"properties_attributes" : { },
"properties" : { }
}
},
{
"spark2-hive-site-override" : {
"properties_attributes" : { },
"properties" : {
"hive.metastore.client.connect.retry.delay" : "5",
"hive.server2.enable.doAs" : "false",
"hive.server2.thrift.port" : "10016",
"hive.server2.transport.mode" : "binary",
"hive.metastore.client.socket.timeout" : "1800"
}
}
},
{
"tez-env" : {
"properties_attributes" : { },
"properties" : {
"heap_dump_location" : "/tmp",
"content" : "\n# Tez specific configuration\nexport TEZ_CONF_DIR={{config_dir}}\n\n# Set HADOOP_HOME to point to a specific hadoop install directory\nexport HADOOP_HOME=${HADOOP_HOME:-{{hadoop_home}}}\n\n# The java implementation to use.\nexport JAVA_HOME={{java64_home}}",
"enable_heap_dump" : "false",
"tez_user" : "tez"
}
}
},
how we can capture only the lines that start with:
"properties" : {
and ended with
}
example of expected output
"properties" : { }
"properties" : {
"hive.metastore.client.connect.retry.delay" : "5",
"hive.server2.enable.doAs" : "false",
"hive.server2.thrift.port" : "10016",
"hive.server2.transport.mode" : "binary",
"hive.metastore.client.socket.timeout" : "1800"
}
"properties" : {
"heap_dump_location" : "/tmp",
"content" : "\n# Tez specific configuration\nexport TEZ_CONF_DIR={{config_dir}}\n\n# Set HADOOP_HOME to point to a specific hadoop install directory\nexport HADOOP_HOME=${HADOOP_HOME:-{{hadoop_home}}}\n\n# The java implementation to use.\nexport JAVA_HOME={{java64_home}}",
"enable_heap_dump" : "false",
"tez_user" : "tez"
}
what I did until now is this syntax , is it the best approach ?
awk '/"properties" : {/,/^[[:blank:]]*}$/' file.json