yazdmich

Untitled

Aug 30th, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. import sys
  2. import os
  3. import re
  4. arg = sys.argv[1].encode()
  5. print(arg)
  6. files = os.listdir()
  7. for file in files:
  8.         if file.endswith('.log'):
  9.                 with open(file, mode='rb') as log:
  10.                         for line in log:
  11.                                 string1 = re.search(arg, line)
  12.                                 if string1:
  13.                                         print(line)
Advertisement
Add Comment
Please, Sign In to add comment