Operating System - HP-UX
1847343 Members
2833 Online
110264 Solutions
New Discussion

Re: Shell Script -Find value - Email

 
SOLVED
Go to solution
Nikee Reddy
Regular Advisor

Shell Script -Find value - Email

Hello,

There is a file (output.lst) and the file consists of following lines: Example

VSAT 82
SkyStarHub 92
COnnections 70

My aim here is, if there is any line in the output.lst which has a value more than 90, I would like to receive an email with the information Example:

SkyStarHub 92

I need a script for this. Please help me.

Thanks & regards,
Nikee
2 REPLIES 2
curt larson_1
Honored Contributor
Solution

Re: Shell Script -Find value - Email


awk '{
if ( $2+0 > 90 ) print $0;
}' output.lst |
while read message
do
mailx -s "$(hostname):$message" you@mailaddress
done
KapilRaj
Honored Contributor

Re: Shell Script -Find value - Email

Can I make it in a line ?

cat output.lst |awk '{ if ($2 >> 92) print $0}' |mail -s Stats email you@yourdomain.com

Regds,

Kaps
Nothing is impossible