dotfiles/tools/print-matches.py

11 lines
150 B
Python

import sys
import re
pattern = sys.argv[1]
p = re.compile(pattern)
for line in sys.stdin:
m = p.match(line)
if m:
print m.group(1)