2

次のコマンドで iperf を複数回実行しています

iperf -c 1.1.1.1 -t 60 -w 6400 -f m >> iperf.log

場合によっては、異なる引数を使用します。結果iperf.logは次のようになります。

[ 3] local 2.2.2.2 port 51129 connected with 1.1.1.1 port 5001 
[ ID] Interval Transfer Bandwidth 
[ 3] 0.0-20.0 sec 1869 MBytes 784 Mbits/sec
[ 3] local 2.2.2.2 port 51130 connected with 1.1.1.1 port 5001 
[ ID] Interval Transfer Bandwidth 
[ 3] 0.0-15.0 sec 1445 MBytes 808 Mbits/sec

私ができるようにしたいのは、平均転送速度を出力することが完了したら、つまり

 average ....... XXX Mbits/sec
4

2 に答える 2

1

awk行く方法です。次のようなものを試すことができます:

iperf -c 1.1.1.1 -t 60 -w 6400 -f m|awk -F 'MBytes' {'print $2'} >> iperf.log

空行を今すぐ削除する必要があります。それはあなたに任せます。:)

于 2014-05-07T21:36:13.280 に答える