We have these files in say \home\abcd\dm
Summary.txt
log_SI-100.lst
log_SI-101.lst
log_SI-106.lst
The contents of Summary.txt is as below
./log_SI-100.lst:Error detected, rollbacking ./log_SI-101.lst:Error detected, rollbacking ./log_SI-106.lst:Error detected, rollbacking
Now i need a statement which will get all the file names from Summary.txt and then append the contents of these files and send it as an email.
For the above example, the contents of files
log_SI-100.lst
log_SI-101.lst
log_SI-106.lst
will be appended and sent as an email.. please help me out..
ctsgnb
April 27, 2011, 8:55am
2
Something like
cat $(sed 's/:[^.]*/ /g' summary.txt) | mailx -s "your subject" user@domain.com
1 Like
It works ... only thing is i have to be in the directory where these log_SI-100.lst
files are.. can i specify the path for these files in the code itself.. so that it wil work anywhere??
ctsgnb
April 28, 2011, 3:20am
4
YOURPATH=/tmp/whatever
cat $(sed "s/:[^.]*/ /g;s:[.]/:$YOURPATH/:g" summary.txt) | mailx -s "your subject" user@domain.com
1 Like
Same one.. but have to send those log files as an attachment and i have write something in the body of the mail.. how do i do that.. thanks
You can have a look at Command line/Script to send E-mail with HTML body and binary attachment Post: 302111802
or Email with multiple attachments & HTML body
you can also give a try to
YOURPATH=/tmp/whatever
cat $(sed "s/:[^.]*/ /g;s:[.]/:$YOURPATH/:g" summary.txt) >attachement.txt
( cat yourbodyfile ; uuencode attachement.txt attachement.txt ) | mailx -s "your subject" user@domain.com