#!/bin/usr/python3 import re import sys group = {} regexp = '^(\S+) (\S+) (\S+) \[([^]]+)\] "(\w+) (\S+).*" (\d+) (\S+)' for line in sys.stdin: line = line.rstrip ( ) match = re.match (regexp, line) if match: print (match.group(1)," ",match.group(8))