tail | grep

The program that is running on my machine generates log files. I want to be able to know the number of lines that contain "FT" in the most recent log file. I wrote the following, but it always returns zero. And I know the count is not zero. Any ideas?

ls -rt *.log | tail -n 1 | grep -c FT

you need to assign ls-rt *.log | tail -n 1 to a variable, then grep that.
add | wc -l to the end of it to get the count

a=
a=`ls -rt *.log | tail -n 1`
cat $a | grep "FT" | wc -l

grep -c FT  $(ls -rt *.log | tail -n 1 )

Just so I have something to work with, could you give me a few file names, and the contents of those files? or samples? I like to test my scripts before giving them as answers >_<

-- Ignore the above.. apparently the ninja unix users beat me to it :stuck_out_tongue:

use
find with xarg and wc utility

grep -e "FT" /path/to/log/dir/*.log | wc -l

thanks guys. the following worked for me:

egrep -c FT `ls -rt *.log | tail -n 1`