diff options
author | Lars Wirzenius <liw@liw.fi> | 2019-03-25 09:19:01 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2019-03-25 09:19:01 +0200 |
commit | f7ed2c69f3840f54bd3e54973821b308a998b063 (patch) | |
tree | 3e894b34a0807a116c1ea136bddb4b5f8a1612ca /debuglogtool | |
download | debuglog-master.tar.gz |
Diffstat (limited to 'debuglogtool')
-rwxr-xr-x | debuglogtool | 18 |
1 files changed, 18 insertions, 0 deletions
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') |