fork download
  1. #!/bin/bash
  2. s='siemplog1.nw.lan / 172.31.180.22'
  3. sed -E 's~.*[^0-9]([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*~\1~' <<< "$s"
  4. sed -E 's~.*/ *([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*~\1~' <<< "$s"
  5.  
  6. echo "More alternatives:"
  7. sed -En 's~.*/ *([0-9.]+)~\1~p' <<< "$s"
  8. sed -En 's~.*/ *([0-9.]+).*~\1~p' <<< "$s"
Success #stdin #stdout 0s 4536KB
stdin
Standard input is empty
stdout
172.31.180.22
172.31.180.22
More alternatives:
172.31.180.22
172.31.180.22