0
oc get serviceinstances | grep -v Ready

There are some results that are "Not Ready" but it would take them out as well because it looks for "Ready".

There are lots of different status names and "Ready" are the only ones I don't need.

For instance:

  1. Ready
  2. Not Ready
  3. Error
  4. Failed

I need "Not Ready", "Error", "Failed"

Tom S
  • 511
  • 1
  • 4
  • 19

4 Answers4

0

When the fields are separated by tabs, use

oc get serviceinstances | grep -E "\tReady\t"
Walter A
  • 19,067
  • 2
  • 23
  • 43
0

Try

... | gawk '/\s+Not Ready\s+/ || !/\s+Ready\s+/'
konsolebox
  • 72,135
  • 12
  • 99
  • 105
0

oc get serviceinstances | egrep "Not Ready|Error|Failed"

maryf
  • 140
  • 6
0

If your grep supports -P (PCRE support) option, please try:

oc get serviceinstances | grep -v -P "(?<!Not )Ready"

The regex matches Ready unless it is preceded by Not , then the logic is negated by the -v option.

tshiono
  • 21,248
  • 2
  • 14
  • 22