Sponsored Content
Full Discussion: awk command with if & mail
Top Forums Shell Programming and Scripting awk command with if & mail Post 302942631 by dravi_laxmi on Thursday 30th of April 2015 11:43:55 AM
Old 04-30-2015
Hi Rudic, Thanks for your reply, I have tried your suggestion but it is not working.
Below one I have tried .

Code:
LOGDIR=/file/logs/
export MAIL_LIST=shiva@gmail.com
FILE="$(find $LOGDIR -name "*.txt" -type f|sort -r|head -n1)"
awk '$3 == "SPO" && ($10+0)>=500 { print $3" is running in "$1" from last "$10" secs"; exit 1}' 
FS="," "$FILE" >TMP || { mail -s "test mail" ${MAIL_LIST} <TMP;rm TMP;}

Actually I want to send mail if $10 is equal or above than 500 then mail will be $3" is running in "$1" from last "$10" secs" and if it is below 500 there will be no mail.

Just could you please also describe this command also , that what will be the mail content.
Code:
FS="," "$FILE" >TMP || { mail -s "test mail" ${MAIL_LIST} <TMP;rm TMP;}


Kindly suggest.

Thanks & Regards
Kumar
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problem with xterm & tcsh & sourcing a script in a single command

Hi friends, I have a script that sets the env variable path based on different conditions. Now the new path variable setting should not done in the same terminal or same shell. Only a new terminal or new shell should have the new path env variable set. I am able to do this only as follows: >cd... (1 Reply)
Discussion started by: sowmya005
1 Replies

2. Solaris

identify the mail server for mail command

Hi , I am new to unix , i am using the mail and mailx command to send the mail .How come i will know the my mail command using which server as mail box.. Please help me .. Thanks in advance (1 Reply)
Discussion started by: julirani
1 Replies

3. UNIX for Dummies Questions & Answers

AIX: mail command & server

Hi, I have to change the mail server, but I could not find the file where it is written in. I use the following command: </> echo krneki | mail -v -s "New report" receiver@our.comp Server name ("skala") can be seen in a terminal output .... receiver@our.comp ... Connecting to... (0 Replies)
Discussion started by: frajer
0 Replies

4. Linux

awk filter & Auto gen Mail

hi experts 2012-01-30 10:30:01:812 "y" "NA" "30/01/2012 10:30:01:154 AM" 2012-01-30 10:33:46:342 "y" "NA" "30/01/2012 10:33:45:752 AM" 2012-01-30 10:41:11:148 "n" "200" "30/01/2012 10:41:10:558 AM" 2012-01-30 10:44:48:049 "y" "NA" ... (7 Replies)
Discussion started by: nith_anandan
7 Replies

5. Shell Programming and Scripting

Problem Using If & For loop in AWK Command

I am parsing file for the fields using awk command, first i check 26th field for two characters using substr function if it matches then using for loop on array i search 184th field for 4 chars if it matches then i print the required fields but on execution i get the error, please help...... (5 Replies)
Discussion started by: siramitsharma
5 Replies

6. Shell Programming and Scripting

[Solved] BASH - chaining TEST and COMMAND with && and II

Can you explain what this line of script is doing. What I have understood is : -- variable C is the name of a software which is either not installed, so it must be installed or allready installed and then should be update if newer version found -- branch B="$B $C" is to install the software --... (4 Replies)
Discussion started by: jcdole
4 Replies

7. Homework & Coursework Questions

Creating a function that sends a mail using mail command

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: The function will be called m and it will allow you to send an email to someone using the mail command. The... (1 Reply)
Discussion started by: Drucian
1 Replies

8. Shell Programming and Scripting

Different output for awk command on Linux & HP-UX

I am using an awk command to extract a particular portion of a string. Below is the command and its output on a Linux system: oracle@host1:/tmp (/home/oracle) $uname -a Linux host1 2.6.32-279.39.1.el6.x86_64 #1 SMP Fri Nov 15 05:38:26 EST 2013 x86_64 x86_64 x86_64 GNU/Linux ... (7 Replies)
Discussion started by: veeresh_15
7 Replies

9. Shell Programming and Scripting

Need Script to ZIP/SAVE & then DELETE Log file & send a mail conformation for any error

ENVIROMENT Linux: RHEL 6.4 Log Path: /usr/iplanet/servers/https-company/logs Log Format: user.log.03-15-2015 I have log4j log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I need a script that will run daily that... (1 Reply)
Discussion started by: admin_job_admin
1 Replies
mlmmj-process(1)					      General Commands Manual						  mlmmj-process(1)

NAME
mlmmj-process - process mail for an mlmmj managed mailinglist SYNOPSIS
mlmmj-process -L /path/to/list -m /path/to/mail [-h] [-P] [-V] -h: This help -L: Full path to list directory -m: Full path to mail file -P: Don't execute mlmmj-send (debugging only) -V: Print version DESCRIPTION
This is the binary which processes a mail. Examples of what such processing is: o Access control Using the access rules specified in <listdir>/control/access to perform access control to the list. This is done before headers are stripped, so one can create allow rules based on headers that are later stripped. o Header stripping Headers specified in <listdir>/control/delheaders are deleted from the mail. o Header addition Headers specified in <listdir>/control/customheaders are added to the mail. This could be headers like List-ID: or Reply-To: o List control In case there's a mail with a recipient delimiter it's not a regular list mail. Processing of these happens in mlmmj-recieve as well. Examples of such are subscription requests, mails to owner etc. It will base it's recipient delimiter detection on the Delivered-To: header if present. If not, the To: header is used. o Moderation If the list is moderated, it will happen in mlmmj-process. When processing is done, it will invoke the needed binary according to whatever mail it is. If it's a subscription request it will invoke mlmmj-sub, if it's a regular list mail it will invoke mlmmj-send. SEE ALSO
The file TUNABLES from the mlmmj source distribution or in the documentation directory of the operating system distribution. AUTHORS
This manual page was written by the following persons: Soren Boll Overgaard <boll@debian.org> (based on html2man output) Mads Martin Jorgensen <mmj@mmj.dk> mlmmj-process September 2004 mlmmj-process(1)
All times are GMT -4. The time now is 10:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy