python grep users from passwd

import re
for i in list(open("/etc/passwd")):
m=re.search(r"^\broot\b", i)
if m:
print i
....:
root:x:0:0:root:/root:/bin/bash

Leave a Reply

Your email address will not be published. Required fields are marked *