fork download
  1. #!/bin/bash
  2. s='pod: nginx-ccas-apache-0
  3. name: nginx-ccas-apache
  4. image: myregnapq//ccas_apache
  5. name: nginx-filebeat
  6. pod: nginx-ccas-apache-1
  7. name: nginx-ccas-apache
  8. image: myregnapq/ccas_apache
  9. name: nginx-filebeat'
  10.  
  11. awk -F: '/:[[:space:]].*ccas-apache$/{sub(/^[[:space:]]+/, "", $2); print $2; exit}' <<< "$s"
  12.  
Success #stdin #stdout 0.01s 5412KB
stdin
Standard input is empty
stdout
nginx-ccas-apache