Skip to main content
2 of 2
made capture of speed field(s) more robust
steeldriver
  • 83.9k
  • 12
  • 124
  • 175

Using awk in paragraph mode

awk -vRS='\n[ \t]*--' '
  match($0, /\( *[0-9]+\)/) {print $1, substr($0,RSTART,RLENGTH)}
' file
foo-6-25.example.com: ( 49)
foo-5-4.example.com: ( 19)
foo-8-28.example.com: ( 43)
foo-9-7.example.com: ( 91)
foo-5-19.idmz.example.com: ( 19)
foo-7-3.example.com: ( 20)
steeldriver
  • 83.9k
  • 12
  • 124
  • 175