fork(2) download
  1. #!/bin/bash
  2. regex='((25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})'
  3. echo "1.1.1.1 asdsad" | \
  4. awk -v rx="$regex" 'match($0,rx){print substr($0,RSTART,RLENGTH)}'
  5. #awk '/((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)/{print $0}'
Success #stdin #stdout 0.01s 5528KB
stdin
Standard input is empty
stdout
1.1.1.1