Sponsored Content
Top Forums Shell Programming and Scripting how to put subject and body to mail from two files Post 302562952 by sri1977 on Sunday 9th of October 2011 05:29:09 AM
Old 10-09-2011
how to put subject and body to mail from two files

Hi all,

My sample file is something like this,

Code:
ORA-00206: Message 206 not found;  product=RDBMS; facility=ORA

ORA-00202: Message 202 not found;  product=RDBMS; facility=ORA

ORA-27063: Message 27063 not found;  product=RDBMS; facility=ORA

ORA-00206: Message 206 not found;  product=RDBMS; facility=ORA

ORA-27063: Message 27063 not found;  product=RDBMS; facility=ORA

ORA-00221: Message 221 not found;  product=RDBMS; facility=ORA


I want to filter "ORA" codes (Ex: ORA-00206,ORA-00202..) and the other part in that line seperately.Then put ORA code part in to mail subject and other part in the mail subject and send mail for each line seperately.I want to do this for that file every hour.I have write script for that(ecept the every one hour part), with that I can do put the ORA code part to subject line but can't put the other part to the body of the mail.Please go thorough with my code and help me to do this.
Code:
awk '/ORA/ { print $0 }' awk1.log > new

a=0
while read LINE
do a=$(($a+1));
awk '/ORA-/ { print $0 }' new | cut -c -10 > new1
awk '/ORA-/ { print $0 }' new | cut -d ":" -f 2- new > new2
mail -s $LINE -r sj@xxxx.com sj@xxxx.com < /home/sss/new2 
echo $LINE;
done < new
echo "Final line count is: $a";

*** awk1.log is my original file and I grep only ORA line to 'new' file,then grep only ORA codes to 'new1' and other part to 'new2'.

*** I need grep code to grep awk1.log to 'new' every one hour.

Moderator's Comments:
Mod Comment Video tutorial on how to use code tags in The UNIX and Linux Forums.

Last edited by Franklin52; 10-10-2011 at 03:15 AM.. Reason: Please use code tags, thank you
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to get åäö in e-mail message body

First of all: Hi all, i´m a new unix user and i´m swedish so please bare with me. When i generate an e-mail on a unix server and send it through novell netware 5, i loose the swedish characters å, ä and ö in the body of the message, however they remain in the subject row. What to do? Anyone?... (4 Replies)
Discussion started by: de98luto
4 Replies

2. UNIX for Dummies Questions & Answers

How to send body in a mail

Hi, How to send send body along with attachment in a mail given below is code to send mail with attachemnt.its working fine but i need to send some message as body of the mail. uuencode /prod/applc/ds_data/mac/working/nullctry.csv "nullctry.csv" | mailx -s "List Of Attendance"... (6 Replies)
Discussion started by: rajendragora
6 Replies

3. AIX

Send mail attachments and have a mail body

Hi, How can I send mail attachments from shell script (AIX) and have a mail body as well ? Thanks in advance. (1 Reply)
Discussion started by: shibajighosh
1 Replies

4. Shell Programming and Scripting

How to mail with this body

Hi, i have a file ABC, i want to mail the contents of this file and i want to make the body of the mail per my choice like this: Hi All, This is the Report for today. <Browse of the File ABC> i am using : mailx -s "Today's Report" abcd@xyz.com << EOT Hi All, This is... (1 Reply)
Discussion started by: Prat007
1 Replies

5. Shell Programming and Scripting

unix mail body with attachment

How can I send mail with attachment in HP-UX I am able to send mail with specific body,but not successful while attaching a file. I am using the below command however it stuck : uuencode test.txt |mailx -s "Subject" <e-mail id> (5 Replies)
Discussion started by: gautamadak
5 Replies

6. Shell Programming and Scripting

mail: subject and body text

HI, After giving the mail -e name@domain.com its asking the subject : after this its enter in to the body of the mail i.e. (in edit mode) How to end this edit process to send mail ? (2 Replies)
Discussion started by: thelakbe
2 Replies

7. Shell Programming and Scripting

Mail with body

Hello All, I wish to mail after completion of code. I would like to include subject and body in it. I am not looking to read the body from other file but willing to provide the body in the command itself. Can i do this way? I am looking to pass some parameters to body and this will be possible... (1 Reply)
Discussion started by: forums123456
1 Replies

8. Shell Programming and Scripting

Grep the last line and put on mail subject

I have mail: cat /home/oracle/scripts/dbsizedaily.txt | mail -s "$TODAY: PROD DB Size" $RECIPIENTS I like to get and put USED_GB and %USED of the very last row from /home/oracle/scripts/dbsizedaily.txt. /home/oracle/scripts/dbsizedaily.txt has : DATE TIME TOTAL_GB USED_GB ... (6 Replies)
Discussion started by: Daniel Gate
6 Replies

9. Shell Programming and Scripting

Difficulty to send image in mail body.

I have jpg file in my server. I am facing difficulty while sending the image in body . appreciate your help to fix to below code. echo "--FILEBOUNDARY" echo "Content-Type: image/jpg" echo "Content-Disposition: inline; filename=\"tick.jpg\"" echo... (3 Replies)
Discussion started by: Jewel
3 Replies

10. Shell Programming and Scripting

Required to get out put of log in tabular format in email body

Dears Please support I have out put in text file and look like below fixed inquiries - Click on MAX suffix http://server:port/app User Details http://server:port/app Audit User Detail Action hhttp://server:port/app fixed inquiries - Click on MAX suffix http://server:port/app User Details ... (13 Replies)
Discussion started by: mirwasim
13 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 05:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy