Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import re
- matched = []
- log = open("Logfile.log")
- log_duplicates = open("Logile_duplicate.log", "w")
- for line in log:
- match = re.search(r'ERROR.+', line)
- if match:
- match_string = match.group()
- if not match_string in matched:
- print(match_string)
- matched.append(match_string)
- log_duplicates.write(match_string + "\n")
- log.close()
- log_duplicates.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement