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

 
your awk command | grep "\"100\""  && mailx -s "Value found" abc@xyz.com

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

above command is not working

1) provide the exact command you used ?
2) Are you getting any error ?

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

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,

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

but it stoping in cc.
i have to press ctrl+D
is there any solution for this

1) create a dummy file in /tmp ( count.txt )
2) insert value 0 to the count.txt

 
old_count=$(cat /tmp/count.txt)
current_count=$(grep -c "\"100\"" log.csv)
if [ $current_count > $old_count ]
then
 #send email -- grep the value from the log.csv
 echo $current_count > /tmp/count.txt
fi