나는 핑하고 destination_ip
연속 패킷 손실 수를 ping_result.txt
파일로 리디렉션 하고 싶습니다 . ping 결과가 다음과 같다고 가정합니다.
reply from destination_ip
request timed out
request timed out
reply from destination_ip
request timed out
request timed out
request timed out
request timed out
reply from destination_ip
출력은 다음과 같아야합니다.
0
1
2
0
1
2
3
4
0
awk에서 :
... | awk '/reply/{count = 0} {print count++}' > ping_result.txt
본질적으로 :
count
회신을 받으면 재설정 하십시오.count
하고 증분하십시오.이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다