On Tue, 30 Nov 1999, Jim Bija wrote:

> I am using sendmail 8.9.3 and need to send the same message to every single
> person in the passwd file. Well not the system account etc, but ya know all
> my "users". Can i get some insight on an easy way to do this?

The following single line will do the trick. Note that the script makes
one assumtion: that all real users have uid's above 500 (normal on
RHL). However, if you run qmail or other processes as a user, you may need
to modify the grep in the secondary example to filter out those special
cases.

        cat /etc/passwd | cut -f1,3 -d: | sed 's/:/ /' | \ 
        awk '$2 >= 500 { print $1 }' | \
        xargs -n1 -i Cmail -s "Some Subject" {} < message_body.txt

        cat /etc/passwd | cut -f1,3 -d: | sed 's/:/ /' | \ 
        awk '$2 >= 500 { print $1 }' | \
        grep -v `qmail|somedaemon|your_account' | \
        xargs -n1 -i Cmail -s "Some Subject" {} < message_body.txt

-- 
Todd A. Jacobs
Network Systems Engineer



-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to