From f7ed2c69f3840f54bd3e54973821b308a998b063 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 25 Mar 2019 09:19:01 +0200 Subject: Add: initial commit --- debuglogtool | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 debuglogtool (limited to 'debuglogtool') diff --git a/debuglogtool b/debuglogtool new file mode 100755 index 0000000..526a41a --- /dev/null +++ b/debuglogtool @@ -0,0 +1,18 @@ +#!/usr/bin/python + +import json, sys + + +records = json.load(sys.stdin) + +result = [] + +for expr in sys.argv[1:]: + key, value = expr.split('=', 1) + for record in records: + if key in record and record[key] == value: + if record not in result: + result.append(record) + +json.dump(result, sys.stdout, indent=2) +sys.stdout.write('\n') -- cgit v1.2.1