fork(1) download
  1. #!/bin/bash
  2. s="tcp 0 0 10.1.1.1:601 10.1.1.2:935 ESTABLISHED 842/hgd
  3. tcp 0 0 10.1.1.1:55394 10.1.1.2:3490 ESTABLISHED 842/hgd"
  4. awk -F'[:[:space:]]+' '/hgd/ && $7 == "935" { print $5 }' <<< "$s"
Success #stdin #stdout 0.01s 4468KB
stdin
Standard input is empty
stdout
601