| 123456789101112131415161718192021222324 | 
							- #!/usr/bin/env python3.3
 
- from pyawk import PyAwk, p
 
- class LTSVParser(PyAwk):
 
-     def begin(self):
 
-         self.FS = '\t'
 
-         self.count = 0
 
-     def action(self, S):
 
-         if not p(S[0], r'status:200'):
 
-             self.count += 1
 
-             self.print('----------')
 
-             d = {}
 
-             for elem in S[1:]:
 
-                 key, value = elem.split(':', 1)
 
-                 d[key] = value
 
-             self.print(d)
 
-     def end(self):
 
-         self.print('----------')
 
-         self.print('Total:{}'.format(self.NR))
 
-         self.print('Matched:{}'.format(self.count))
 
- if __name__ == '__main__':
 
-     LTSVParser().run()
 
 
  |