2016-05-19 28 views

Antwort

3

Sie können alles mit awk bekommen und vermeiden grep, cut:

ping -c 1 google.com | awk -F= '/bytes from/{print $2}' 
0 ttl 

btw sollte Ihr Befehl sein:

ping -c 1 google.com | grep "bytes from" | cut -d = -f 2 

die gleiche Leistung zu erhalten, wie 0 ttl Feld # 2

+0

@MonaJalal: Hat das für Sie funktioniert? – anubhava

1
ping -c 1 google.com | grep "bytes from" | cut -d = -f2 
0 ttl 

Wenn Sie bis 0 erhalten möchten ttl dann

ping -c 1 google.com | grep "bytes from" | cut -d = -f1-2 
64 bytes from yyz08s14-in-f14.1e100.net (172.217.2.142): icmp_seq=0 ttl