This post is older than a year. Consider some information might not be accurate anymore.
I want to grep this output for postgresql
, but want to keep the column headers.
$ oc get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
elasticsearch-persistent-elasticsearch-0 Bound pvc-56d17d9d-0bae-11ea-90a8-005056ab11cb 10Gi RWO vsphere-standard 1d
postgresql Bound pvc-9edfc710-0b9c-11ea-90a8-005056ab11cb 30Gi RWO vsphere-standard 1d
We use an alternate pattern, i.e. the first column name NAME
.
$ oc get pvc | grep -E 'NAME|postgresql'
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
postgresql Bound pvc-9edfc710-0b9c-11ea-90a8-005056ab11cb 30Gi RWO vsphere-standard 1d