The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: Mailx usage
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-28-2008
karthikn7974's Avatar
karthikn7974 karthikn7974 is offline VIP Member  
Supporter
  
 

Join Date: Jul 2007
Location: Singapore
Posts: 58
Mailx usage

Hi
Having the below four log files.

logfile1
Code:
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
Code:
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

Code:
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
==========
Code:
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