Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

generate user list then append emal address to end

Status
Not open for further replies.

phymen

ISP
Mar 23, 2010
1
CA
Hello:

Been trying to develop a script with a list of user names from our Sun mailserver, with Solaris 10 and Postfix. I had the script collect all the home directories in /home then dump to a file and then did vi +:/%s/&/\@domain.com/g which works but then shell hangs and when I break out of the process vi is waiting for the :wq input. I've looked at sed, awk and cat as alternatives, is there another way to accomplish this? Once this file is generated I'll want to do an include: reference in /etc/postfix/aliases then restart Postfix to send out the email to all of our customers.

Thanks for any suggestions,
Phymen
 
Is the list of home directories more reliable than /etc/passwd in this scenario for some reason?

This should be equivalent to what you're trying to do in vi:

Code:
sed 's/&/\@domain.com/g' inputfile > outputfile

However if you prefer you could also do it with vi to edit the file in place using:

Code:
vi +'%s/&/@domain.com/g|wq' inputfile

As you see you can separate multiple vi commands using |.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top