Thanks for your continuous support, Now again this is not giving any output or mail even though it met with condition .
I have attached the input file inputfile.txt (4.6 KB).
I have tried the below script, I am trying to search BHU file which is in column 3 & also the value which is in column 10 greater or equal than 500 in inputfile.txt file.
But there is no putput or mail is coming. I have also tried to print $TMP & $FILE file also , it is giving the $file output but $TMP there is no value.
I am very new to scripting , please help me.
I have tried what you have suggested, but it is mailing only first row of all the rows which are having more than 500 values.
means if in input file if there are 5 BTC which are having above 500 , it is mailing only first row ,other rows are not coming in mail.
Code:
#!/bin/ksh
LOGDIR=file/logs
export MAIL_LIST=shyam@gmail.com
FILE="$(find $LOGDIR -name "*.txt" -type f|sort -r|head -n1)"
awk '($3 == "BTC") && (($10+0) >=500) {print $3" is running in "$1" from last "$10" secs";exit 1}' "$FILE" > TMP || { mail -s "test mail" ${MAIL_LIST} <TMP; rm TMP; }
I have tried what you have suggested, but it is mailing only first row of all the rows which are having more than 500 values.
means if in input file if there are 5 BTC which are having above 500 , it is mailing only first row ,other rows are not coming in mail.
Code:
#!/bin/ksh
LOGDIR=file/logs
export MAIL_LIST=shyam@gmail.com
FILE="$(find $LOGDIR -name "*.txt" -type f|sort -r|head -n1)"
awk '($3 == "BTC") && (($10+0) >=500) {print $3" is running in "$1" from last "$10" secs";exit 1}' "$FILE" > TMP || { mail -s "test mail" ${MAIL_LIST} <TMP; rm TMP; }
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)
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)
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)
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)
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)
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)
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)
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)