[root@k8s-master01 ~]# cat aa1.txt aaaabbbccc jfdjk asdfghj zxcvbqwertyuiop helloword [root@k8s-master01 ~]# sed -nr 's#he(.*)rd#\1#gp' aa1.txt llowo [root@k8s-master01 ~]# sed -i.bak -r 's#he([a-z]+)rd#hekkkrd#g' aa1.txt [root@k8s-master01 ~]# cat aa1.txt aaaabbbccc jfdjk asdfghj zxcvbqwertyuiop hekkkrd [root@k8s-master01 ~]# sed -i.bak 's#he([a-z]+)rd#he===rd#g' aa1.txt [root@k8s-master01 ~]# cat aa1.txt aaaabbbccc jfdjk asdfghj zxcvbqwertyuiop hekkkrd [root@k8s-master01 ~]# sed -i.bak -r 's#he([a-z]+)rd#he===rd#g' aa1.txt
标签:k8s,ip,master01,rd,sed,aa1,字符串,txt,root From: https://www.cnblogs.com/gaoyuechen/p/16905517.html