awk计算丢包率

阅读 96

2023-03-05


    1.  #author souroot
    2. : souroot@163.com
    3. formular: (all the send packets in agents layer)
    4. #-(all the recieve packets in agents layer) as all the lost packets
    5. {
    6. send;
    7. ;
    8. }
    9. {
    10. if(($1)=="s" && ($4)=="AGT")
    11. send++;
    12. if(($1)=="r" && ($4)=="AGT")
    13. ++;
    14. }
    15. {
    16. "send is %d, recv is %d\n",send,recv;
    17. "drop rate is %4f\n",(send-recv)/send;
    18. }



    $1代表第一列,$4代表第四列。BEGIN表示循环开始,END表示循环结束



    精彩评论(0)

    0 0 举报