Mailx usage

Hi
Having the below four log files.

logfile1

date               time        server     ip 
10/10/2008      10:10      ServerA   xxx.xxx.xxx.xxx
10/10/2008      10:11      ServerA   xxx.xxx.xxx.xxx
10/10/2008      10:12      ServerA   xxx.xxx.xxx.xxx

logfile2

date               time        server     ip 
10/10/2008      10:10      ServerB   xxx.xxx.xxx.xxx
10/10/2008      10:10      ServerB   xxx.xxx.xxx.xxx
10/10/2008      10:10      ServerB   xxx.xxx.xxx.xxx

ans so on...

how to send mail using mailx
i need to sent all the four files in one email
i tried this... any one can suggest

cat logfile1 >> logfile
cat logfile2 >> logfile
cat logfile3 >> logfile
cat logfile4 >> logfile

cat logfile | mailx -s 'Server logs for the day' xxx@xxx.com

i am not able to insert any headers after each log files
but i need like the below format

Body of email

Server A Logs for the day 
===================
XXX
XXX
XXX

Server B Logs for the day 
===================
XXX
XXX
XXX

Server C Logs for the day 
===================
XXX
XXX
XXX

Server D Logs for the day 
===================
XXX
XXX
XXX

can any one help me how to manipulate this

Thanks in advance

Hi,
You could insert the 'headers' between each cat

echo "Server A Logs for the day" >> logfile
echo "=========================" >> logfile
cat logfile1 >> logfile
echo "Server B Logs for the day" >> logfile
echo "=========================" >> logfile
cat logfile2 >> logfile
...
cat logfile3 >> logfile

cat logfile | mailx -s 'Server logs for the day' xxx@xxx.com

Or create them as attachments; the mail FAQ section has a script you can use.

PS. That was quite an orgy of useless cats. The purpose of cat is to catenate files. Even though it doesn't work, I need to point out that the Useful way to write your original command would have been

cat logfile1 logfile2 logfile3 logfile4 | mailx -s 'Server logs for the day' xxx@xxx.com