- 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 Shell统计每秒钟内文件增加行数,如需转载请自行联系原博主。