Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Manipulate condition to send mail based on output text in file Post 303038389 by midhun3108 on Monday 2nd of September 2019 04:56:04 AM
Old 09-02-2019
Need to send email for the output saved in the file

HI Jim,

Thanks for your answer. I meant append is referring to content in the email. i.e I have to extract only from the .out file the return code of a ABC.sh script. that I'm handling in another code.
So basically,
"echo "Files loaded with $(cat /var/tmp/script.X1.out)" | mail -s "Files loaded with return code" mailid " -- this code gives the output(return code) from file and send email with subject in quotes.

All I want is
  • if script.X1.out contains, Return code 0, then SUCCESS to be appended after the first pipeline in the email content.
  • if script.X1.out contains, Return code 1, then WARNING to be appended after the first pipeline in the email content.
  • if script.X1.out contains, Return code 2, then FAIL to be appended after the first pipeline in the email content.

script.X1.out value always changes so i'm doing cat from it or i can change it to grep as you suggested. can you please help on the code for the above scenario.

OS : Linux.

Thanks,
Midhun

Last edited by hicksd8; 09-02-2019 at 06:57 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Send text file to mail

I have a utility that opens a telnet session and allows me to execute commands through a script. The utility allows me to output to a text file whatever is outputted to screen. This utility runs from a DOS prompt in Windows 95/98, NT or 2000. How can I mail text file this to a certain user. I... (2 Replies)
Discussion started by: petrosi
2 Replies

2. UNIX for Advanced & Expert Users

How to parse through a file and based on condition form another output file

I have one file say CM.txt which contains values like below.Its just a flat file 1000,A,X 1001,B,Y 1002,B,Z ... .. total around 4 million lines of entries will be in that file. Now i need to write another file CM1.txt which should have 1000,1 1001,2 1002,3 .... ... .. Here i... (6 Replies)
Discussion started by: sivasu.india
6 Replies

3. Shell Programming and Scripting

Send a mail to IDs listed in a text file

I have a list of mail ids in text file and want a ksh script that reads this text file and sends a mail to all mail ids with same subject line and content. I am using UX-HP machine and KSH. Thanks for help in advance! (5 Replies)
Discussion started by: Sriranga
5 Replies

4. UNIX for Advanced & Expert Users

Output will send in mail

Hi All, Requirement is to select the data from database and send the output in mail. But the output should in HTML tabular format in mail body. For example my select command is : select ename,esal,edegn,dept from emp where deptno in (10,15); In the mail body the output should : Employee... (3 Replies)
Discussion started by: alex_us
3 Replies

5. UNIX for Advanced & Expert Users

send mail script only if condition is met

only wc -l greater than 0 then send email to owner, otherwise do nothing. ie. result=powermt display dev=all|awk '{print $7}'|grep -i dead|wc -l if then echo $result else : fi mailx -s "there is dead path (s)" "mymail@mydomain.com" ----------- it is not working... (2 Replies)
Discussion started by: orafup
2 Replies

6. Shell Programming and Scripting

Help with File processing - Adding predefined text to particular record based on condition

I am generating a output: Name Count_1 Count_2 abc 12 12 def 15 14 ghi 16 16 jkl 18 18 mno 7 5 I am sending the output in html email, I want to add the code: <font color="red"> NAME COLUMN record </font> for the Name... (8 Replies)
Discussion started by: karumudi7
8 Replies

7. Shell Programming and Scripting

Replace text inside XML file based on condition

Hi All, I want to change the name as SEQ_13 ie., <Property Name="Name">SEQ_13</Property> when the Stage Type is PxSequentialFile ie., <Property Name="StageType">PxSequentialFile</Property> :wall: Input.XML <Main> <Record Identifier="V0S13" Type="CustomStage" Readonly="0">... (3 Replies)
Discussion started by: kmsekhar
3 Replies

8. Shell Programming and Scripting

Send mail based on a group

Hello Gurus, I have a question. I have a file which has 2 columns and is tab separated and looks like below: FIELD1 FIELD2 Manual m456@hotmail.com Execution din098@gmail.com Artistic m456@hotmail.com Graphic din098@gmail.com FIELD2 values will have always either of the 2 above... (8 Replies)
Discussion started by: Max499
8 Replies

9. UNIX for Advanced & Expert Users

Group the records based on empno and send mail

Hi All, I have records in a file with name,SSO,openitems,manageremail with | delimited file.Now i want to group the records by SSO and openitems and send email to their manageremail. kiran|1111|draft|aaa@gmail.com guna|2222|reject|bbb@gmail.com kiran|1111|submitter|aaa@gmail.com... (2 Replies)
Discussion started by: kiranparsha
2 Replies

10. UNIX for Beginners Questions & Answers

Read a file and send mail based on grep

Hi All, I am having a job and I need to send email when the job is running. On any other case (success,fail) I don't needed to send email. I check with BMC they told they dont have that in the version I am using. So I created a dependent job and grepped for the status and sent email. My... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies
PIUS(1) 						      General Commands Manual							   PIUS(1)

NAME
pius - PGP Individual UID Signer SYNOPSIS
pius [options] -s <signer-keyid> <keyid> [<keyid> ...] pius [options] -A -r <keyring-path> -s <signer-keyid> DESCRIPTION
pius The PGP Individual UID Signer (PIUS) is a tool for individually signing all of the UIDs on a set of keys and encrypt-emailing each one to it's respective email address. This drastically reduces the time and errors involved in signing keys after a keysigning party. OPTIONS
--version show program's version number and exit -h or --help show this help message and exit -a or --use-agent Use pgp-agent instead of letting gpg prompt the user or every UID. [default: false] -A or --all-keys Sign all keys on the keyring. Requires -r. -b PATH or --gpg-path=PATH Path to gpg binary. [default: /usr/bin/gpg] -e or --encrypt-outfiles Encrypt output files with respective keys. -d or --debug Enable debugging output. -H HOSTNAME or --mail-host Hostname of SMTP server. [default: localhost] -i or --interactive Use the pexpect module for signing and drop to the gpg shell for entering the passphrase. [default: false] -I or --import Also import the unsigned keys from the keyring into the default keyring. Ignored if -r is not specified, or if it's the same as the default keyring. -m EMAIL or --mail Email the encrypted, signed keys to the respective email addresses. EMAIL is the address to send from. See also -H and -p. -M FILE or --mail-text Use the text in FILE as the body of email when sending out emails instead of the default text. To see the default text use --print- default-email. Requires -m. -n EMAIL or --override-email Rather than send to the user, send to this address. Mostly useful for debugging. -o OUTDIR or --out-dir Directory to put signed keys in. [default: /tmp/pius_out] -O or --no-pgp-mime Do not use PGP/Mime when sending email. -p or --cache-passphrase Cache private key passphrase in memory and provide it to gpg instead of letting gpg prompt the user for every UID. [default: true] -P PORT or --mail-port Port of SMTP server. [default: 25] -r KEYRING or --keyring The keyring to use. Be sure to specify full or relative path. Just a filename will cause GPG to assume relative to ~/.gnupg. [default: ~/.gnupg/pubring.gpg] -s SIGNER or --signer The keyid to sign with (required). -S or --mail-tls Use STARTTLS when talking to the SMTP server. -t TMP_DIR or --tmp-dir Directory to put temporary stuff in. [default: /tmp/pius_tmp] -T or --print-default-email Print the default email. -u USER or --mail-user Authenticate to the SMTP server, and use username USER. You will be prompted for the password. Implies -S. -v or --verbose Be more verbose. AUTHOR
PIUS was written by Phil Dibowitz <phil@ipom.com> This manual page was written by Luke Cycon <lcycon@gmail.com>, for the Debian project (but may be used by others). MARCH 2010 PIUS(1)
All times are GMT -4. The time now is 10:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy