Linux Shell统计每秒钟内文件增加行数

  1 DATE=$(date +%s)
  2 count=$(grep -c "" short.txt)
  3 while true
  4 do
  5         DATE_New=$(date +%s)
  6         if (( $(date +%s) == DATE+1))
  7         then
  8 
  9         DATE=$(date +%s)
 10         count_new=$(grep -c "" short.txt)
 11         add=$((count_new - count))
 12         if [ ! -n "$add" ]    
 13         then
 14         add=0
 15         fi
 16         echo add line number is:$add    
 17         count=$count_new
 18         fi
 19 done


你可能感兴趣的:(Linux)