Interview Prep/Real-World Interview/awk, sed, grep and jq one-liners

From `kubectl get pods -A -o json`, list pods that are not Running, as namespace/name/phase.

IntermediateHands-onawk, sed, grep and jq one-liners
Answer
kubectl get pods -A -o json | jq -r '
  .items[] | select(.status.phase != "Running")
  | "\(.metadata.namespace)/\(.metadata.name)\t\(.status.phase)"'

Key trick → select() filters and \( ) is jq string interpolation. -r prints raw strings without JSON quotes. (Quick alternative: kubectl get pods -A --field-selector=status.phase!=Running.)

All Real-World Interview questions Roadmap: Interview readiness

More on awk, sed, grep and jq one-liners