所以,我有一个命令 ( kustomize build
) 的输出,我想将---
输出中的###
. 例如:
$ kustomize build
apiVersion: extensions/v1
kind: Ingress
metadata:
labels:
app: hello-world
---
apiVersion: v1
kind: Service
metadata:
name: hello-world
spec:
ports:
- name: service
port: 443
targetPort: 8443
selector:
app: hello-world
type: NodePort
我想将其更改为:
apiVersion: extensions/v1
kind: Ingress
metadata:
labels:
app: hello-world
###
apiVersion: v1
kind: Service
metadata:
name: hello-world
spec:
ports:
- name: service
port: 443
targetPort: 8443
selector:
app: hello-world
type: NodePort
我试过$ kustomize build | tr '\---' '#'
了,但这甚至替换了单个'-'
to的每个实例'#'
。我什至尝试过tr '[-]{3}' '#'
,但即使那样也无济于事。我该怎么做呢?