blob: 526a41a9d60deef90c9cd2949a4a64199b4bc0ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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')
|