Post

Scripts

Q. Finding logs -> Via grep and python Searching for Internal Server Logs

python``` import re

pattern = r”\b5\d{2}\b”

with open(‘f.txt’, ‘r’) as f: for line in f: if re.search(pattern, line): print(line.strip())

1
2
3
bash```
grep -E "\b5[0-9]{2}\b"
This post is licensed under CC BY 4.0 by the author.