awk filter & Auto gen Mail


 
Thread Tools Search this Thread
Operating Systems Linux awk filter & Auto gen Mail
# 1  
Old 01-31-2012
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" "30/01/2012 10:44:47:461 AM"
2012-01-30 10:49:06:761 "y" "NA" "30/01/2012 10:49:06:168 AM"
2012-01-30 10:49:28:216 "y" "NA" "30/01/2012 10:49:27:614 AM"
2012-01-30 10:50:18:523 "y" "NA" "30/01/2012 10:50:17:931 AM"
2012-01-30 10:55:12:485 "n" "100" "30/01/2012 10:55:11:820 AM"
2012-01-30 10:56:45:465 "y" "NA" "30/01/2012 10:56:44:872 AM"
2012-01-30 11:02:47:673 "y" "NA" "30/01/2012 11:02:47:81 AM"
this is my script to filter my log file

awk -F"," '{print $1 "\t" $51 "\t" $52 "\t" $54}'
"200"
i want to filter this column & match that charactor "100" then if match automatic alert mail i want to recive how to wright the sctipt
for this any body help me
# 2  
Old 01-31-2012
Code:
 
your awk command | grep "\"100\""  && mailx -s "Value found" abc@xyz.com

# 3  
Old 01-31-2012
Hi itkamaraj


tail -f log.csv |awk -F"," '{print $1 "\t" $3 "\t" $4 "\t" $5 "\t" $6 "\t" $51 "\t" $52 "\t" $54}'| grep "\"100\""

i want to print on screen & mail Also above command is not working
# 4  
Old 01-31-2012
above command is not working

1) provide the exact command you used ?
2) Are you getting any error ?
# 5  
Old 01-31-2012
i am not getting any error cursor just blinking ,no other reaction(or) process

tail -f log.csv |awk -F"," '{print $1 "\t" $3 "\t" $4 "\t" $5 "\t" $6 "\t" $51 "\t" $52 "\t" $54}

up to this i am getting output on the screen

but if i use this command

tail -f log.csv |awk -F"," '{print $1 "\t" $3 "\t" $4 "\t" $5 "\t" $6 "\t" $51 "\t" $52 "\t" $54}'| grep "\"100\"" && mail root@example .com
-
just showing like this
# 6  
Old 01-31-2012
if the "100" value is coming in the tail -f then only you will get the email. because you are grepping for 100. if the grep goes to success, then only you get email.

for testing..

execute your command. and in another console,

Code:
 
echo "\"100\",TESTING" >> log.csv

# 7  
Old 01-31-2012
but it stoping in cc.
i have to press ctrl+D
is there any solution for this
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk command with if & mail

Hi Experts, I want to check in table that if third column value is "bhu" & if it is greater than 500 it will send mail other wise there will be no mail. but as per my script mails are still coming even value is below 500 with one blank mail(without any content) with subject line"test mail". I... (12 Replies)
Discussion started by: dravi_laxmi
12 Replies

2. 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

3. Shell Programming and Scripting

How to find & auto resize images?

I need a command or mini scripts that can find certain type of images file recursively from the current dir with files of minimum 736 width and resize them by "736 max width, relative height" and replace the source files. I currently have GD installed but can also install Imagemagick if needed, I'm... (5 Replies)
Discussion started by: Frozen77
5 Replies

4. Shell Programming and Scripting

Bash for multiple accounts with auto-gen passwords

Hello, I am studying few things on unux and scripting. I need a script to create bulk users in unux. I need some assistance from you for creating 100 or more User IDs using a bash script: Here's my requirements: 1. I need to create 100 or even more user ids of different naming... (1 Reply)
Discussion started by: Shelldorado
1 Replies

5. Shell Programming and Scripting

awk Help: Filter Multiple Entry & print in one line.

AWK Gurus, data: srvhcm01 AZSCI srvhcm01 AZSDB srvhcm01 BZSDB srvhcm01 E2QDI31 srvhcm01 YPDCI srvhcm01 YPDDB srvhcm01 UV2FSCR srvhcm01 UV2FSBI srvhcm01 UV2FSXI srvhcm01 UV2FSUC srvhcm01 UV2FSEP srvhcm01 UV2FSRE srvhcm01 NASCI srvhcm01 NASDB srvhcm01 UV2FSSL srvhcm01 UV2FSDI (7 Replies)
Discussion started by: rveri
7 Replies

6. UNIX for Dummies Questions & Answers

How to auto CC all outgoing e-mail?

I'm using Debian 5.0.4, exim4 and mutt. I would like all outgoing mail sent by any/all users CC (not BCC) to a specified e-mail account. (I do have it working for BCC using 'unseen'.) I have spent hours of searching/reading/testing how and have not been able to find out how. I have seen it... (0 Replies)
Discussion started by: mewbie
0 Replies

7. AIX

AIX auto delete old mail messages

We have had an issue where the mail file filled up. Is there a setting in sendmail.cf to automatically remove old emails? Say after 14 days. If not is there any way automatically to delete older mail files?? (1 Reply)
Discussion started by: daveisme
1 Replies

8. Solaris

auto mail

Hi All, I have solaris 8 on sparc machine, i need to know how i can let my system send to my e-mail any impacts or troubles.... how i can do that?! :confused: thx, (1 Reply)
Discussion started by: ahmad_one
1 Replies

9. UNIX for Advanced & Expert Users

Mail Filter

hai friends. How can i filter the incoming mails to an individual folder.. I am using sendmail. Thanks in advance Collins (4 Replies)
Discussion started by: collins
4 Replies

10. Shell Programming and Scripting

mail filter

Hi all: I have a problem with this simple script. It appears that it should work, but I am getting an error message. I am trying to pass a file through a filter to grep for "urgent" and forward the message to me. Here it is. #!/bin/ksh # if (`grep urgent /tmp/test.tmp| wc -l` -gt 0)... (13 Replies)
Discussion started by: Kelam_Magnus
13 Replies
Login or Register to Ask a Question