Skip to content

Instantly share code, notes, and snippets.

@offby1
Created June 13, 2015 14:46
Show Gist options
  • Select an option

  • Save offby1/2f459c91a745b387f9f8 to your computer and use it in GitHub Desktop.

Select an option

Save offby1/2f459c91a745b387f9f8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from __future__ import print_function
import re
with open ('/etc/passwd') as inf:
for line in inf:
line=line.rstrip()
if any(re.match(pat, line) for pat in (r'^ntp:', r'^nobody:', r'ftp:', r'gopher:')):
print(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment