Created
August 29, 2011 21:34
-
-
Save frankwiles/1179469 to your computer and use it in GitHub Desktop.
Awk is horrible, use Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
import fileinput | |
good_match = re.compile(r'sip:\+?[0-9]+@') | |
for line in fileinput.input(): | |
parts = line.split('|') | |
if good_match.match(parts[17]) and good_match.match(parts[18]): | |
# Good line, print it to stdout | |
print line | |
else: | |
# Bad match, do nothing | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment