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

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