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

All users of our CIP (computer) pool have an e-mail address of login@cip.iff.lmu.de.
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="cip.ifi.lmu.de" ./passwd > mail_list.txt

Output:

Programmierpraktikum Prgprakt <pp99@cip.ifi.lmu.de>
Programmierpraktikum Prgprakt <prgprakp@cip.ifi.lmu.de>
...
Leave a comment

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: