We need to extract e-mail addresses from a text file created by the MDaemon mail server. The userlist.dat is a text file with one user account per line. It does not list the e-mail address in its complete form (firstname.lastname@example.org). It instead lists them as follows:
domain1.com user1 OtherData1a OtherData1b OtherData1c OtherData1d OtherData1e
domain2.com user2 OtherData2a OtherData2b OtherData2c OtherData2d OtherData2e
domain2.com user3 OtherData3a OtherData3b OtherData3c OtherData3d OtherData3e
Im not sure if the spaces between the domain and the user varies or if it is a tab over. But it appears that they vary based on the length of the domain name, so that the second column is vertically aligned. I think I need to use sed, but I am a complete newbie with regard to sed.
The next step is to output the file into a .map file that postfix will be able to use. I believe we know how to do that once we get a list of the complete emails (email@example.com) but any hints or shortcuts here would be appreciated.
PS. The .map file will need to look like: