AWK: extract e-mail addresses from a Unix passwd file

All users of our CIP (computer) pool have an e-mail address of
As I occasionally need to write an e-mail to a student I never had contact with before, I used awk to extract e-mail addresses from the /etc/passwd file.

awk -F: '{print $5" <" $1 "@" mh  ">"}' mh="" ./passwd > mail_list.txt


Programmierpraktikum Prgprakt <>
Programmierpraktikum Prgprakt <>
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: