Follow the details, the site is asking me to include some text because there is mostly code, so i type this sentence, but i think it is self explanatory
Sample log file :
jue 08 abr 2021 13:33:49 -03 : VA John Doe : PING google.com (17x.2xx.1x2.4x): 56 data bytes
--- google.com ping statistics ---
100 packets transmitted, 100 packets received, 0% packet loss
round-trip min/avg/max = 40.462/50.166/62.318 ms
jue 08 abr 2021 13:35:35 -03 : VA John Doe : PING google.com (17x.2xx.1x2.4x): 56 data bytes
--- google.com ping statistics ---
100 packets transmitted, 99 packets received, 1% packet loss
round-trip min/avg/max = 42.055/48.856/136.962 ms
jue 08 abr 2021 13:37:21 -03 : VA John Doe : PING google.com (17x.2xx.1x2.4x): 56 data bytes
--- google.com ping statistics ---
100 packets transmitted, 100 packets received, 0% packet loss
round-trip min/avg/max = 40.058/47.762/64.169 ms
my command so far :
cat sample.log | sed -r -e '/^... [0-9]+ ... [0-9]{4} [0-9]{2}:[0-9]{2}/{s/(... [0-9]+ ... [0-9]{4} [0-9]{2}:[0-9]{2}).*$/\1/g;n;d}' -e '/^--- google.*$/d' -e 's/100 packets transmitted.*([0-9]+%) packet.*$/\1/' -e '/round-trip/d'
result obtained :
jue 08 abr 2021 13:33
0%
jue 08 abr 2021 13:35
1%
jue 08 abr 2021 13:37
0%
desired ideal result :
jue 08 abr 2021 13:33, 0%
jue 08 abr 2021 13:35, 1%
jue 08 abr 2021 13:37, 0%