Skip to content

Instantly share code, notes, and snippets.

@frankwiles
Created August 29, 2011 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankwiles/1179469 to your computer and use it in GitHub Desktop.
Save frankwiles/1179469 to your computer and use it in GitHub Desktop.
Awk is horrible, use Python
#!/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