fork download
  1. #!/bin/bash
  2. s='+---------+------------------------------------------------------+
  3. | Key | Value |
  4. +---------+------------------------------------------------------+
  5. | Address | longstringofcharacters |
  6. +---------+------------------------------------------------------+
  7. | Name | word1-word2-word3 |
  8. +---------+------------------------------------------------------+'
  9. awk -F'[|[:space:]]+' '$2 == "Name"{print $3}' <<< "$s"
  10. awk 'match($0, /[^ -]+(-[^ -]+)+/) { print substr($0, RSTART, RLENGTH) }' <<< "$s"
Success #stdin #stdout 0.01s 5528KB
stdin
Standard input is empty
stdout
word1-word2-word3
word1-word2-word3