Download this file
| 1 | #!/usr/bin/env python3 |
| 2 | """Prints only the [security] items of a numbered review list.""" |
| 3 | import re, sys |
| 4 | items, cur = [], None |
| 5 | for line in open(sys.argv[1]).read().splitlines(): |
| 6 | if re.match(r"\s*\d+\.\s+", line): |
| 7 | cur = [line]; items.append(cur) |
| 8 | elif cur is not None: |
| 9 | cur.append(line) |
| 10 | print("\n".join("\n".join(i) for i in items if re.match(r"\s*\d+\.\s+\[security\]", i[0]))) |
| 11 | |