Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Searching value in table through awk

$
0
0
I need to create one script in which I want to search in txt file , this txt file is having 10 columns , I want to check 4th column value if "BOY" & 10th column value =>500 it will print 4th column row value ,1st column row value & 10th column row value & store the same value in one file as following : BOY is running from last 500 Sec.
I have created but it is not working :-
Code:

LOGDIR=/file/location/

export MAIL_LIST="xxx@in.xxx.com"
var=$(
cat `find $LOGDIR -type f|sort -r|head -n1` | while read line
do
awk '{
if ($3 -eq "BOY" && $10 >= 500) echo "$3 is running in "$1" from last  "$10" secs"
    }'
done)
echo $var

it is giving the output but different row value which is greater than 500.

Viewing all articles
Browse latest Browse all 16232

Trending Articles