Most of my users have
email addresses associated with their profile in /etc/passwd. They are always in the 5th field, which I can grab, but they appear at different places within a comma-separated list in the 5th field.
Can somebody give me a regex to grab just the
email address (delimeted by commas) from a line in this file? (I will be using grep and sed from a bash script)
Sample lines from file:
user1:x:1147:5005:User One,Department,,,
[email protected]:/home/directory:/bin/bash
user2:x:1148:5002:User Two,Department2,
[email protected],:/home/directory:/bin/bash