My Opera is closing 3rd of March

Raphael's Pflock

miscellaneous Opera, Debian, Media and German posts

Subscribe to RSS feed

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>
...