Hi,
I want to read a file that contains email addresses and create a single string variable that contains all of the address, each address with a trialing space. The data in email_aix_users.lst looks like:
user1@my.com
user2@my.com
...
And the code looks like:
MAIL_LIST=`awk ' { print $0 } ' email_aix_users.lst `
MAIL_SUBJECT="$This_Script failed: $This_Host on $Today_Is"
/bin/mail -s"$MAIL_SUBJECT" "$MAIL_LIST" < $MAIL_BODY
I need to append a trailing space following the last entry. I've tried several things, including setting ORS, print $0" ", etc. Neither of which gives me the desired results and messes up the email (The subject appears in the message body along with any of the email address other then the first one, and only the first email address is used for "To:".
I also tried appending a blank to the MAIL_LIST variable:
MAIL_LIST=`awk ' { print $0 } ' email_aix_users.lst `" "
but this causes the same messed up email as described above.
If I set MAIL_LIST="user1@my.com user2@my.com ", the email process works as required.
Any ideas on what I may be doing wrong?
Spaced out...
gawker
I want to read a file that contains email addresses and create a single string variable that contains all of the address, each address with a trialing space. The data in email_aix_users.lst looks like:
user1@my.com
user2@my.com
...
And the code looks like:
MAIL_LIST=`awk ' { print $0 } ' email_aix_users.lst `
MAIL_SUBJECT="$This_Script failed: $This_Host on $Today_Is"
/bin/mail -s"$MAIL_SUBJECT" "$MAIL_LIST" < $MAIL_BODY
I need to append a trailing space following the last entry. I've tried several things, including setting ORS, print $0" ", etc. Neither of which gives me the desired results and messes up the email (The subject appears in the message body along with any of the email address other then the first one, and only the first email address is used for "To:".
I also tried appending a blank to the MAIL_LIST variable:
MAIL_LIST=`awk ' { print $0 } ' email_aix_users.lst `" "
but this causes the same messed up email as described above.
If I set MAIL_LIST="user1@my.com user2@my.com ", the email process works as required.
Any ideas on what I may be doing wrong?
Spaced out...
gawker