0
我需要一些幫助,一個循環和Awk命令。我需要篩選,ping測試腳本輸出其結果爲:Awk Loop |多行
--- hostname1 ping statistics ---
15 packets transmitted, 14 packets received, 6% packet loss
--- hostname2 ping statistics ---
15 packets transmitted, 15 packets received, 0% packet loss
--- hostname3 ping statistics ---
15 packets transmitted, 15 packets received, 0% packet loss
--- hostname3 ping statistics ---
15 packets transmitted, 2 packets received, 86% packet loss
...和我需要的是像一個循環和awk誰過濾器:
1號線 - > awk的' {print $(NF-3)}'' - > hostname1
第2行 - > awk'{print $(NF-2)}' - >這裏我還需要CUT的%編號,如果可能的話
:好吧,這使我解決了很多grep和awk的問題,你就是這樣規定的!非常感謝。 – tiago
+1爲巧妙使用printf()而不是'\ n' – n0741337