linux的sed命令使用
命令:
为所有grpc生成的xxx.pb.go中添加bsonTAG
sed -i -E 's/json:("[^"]+,omitempty")/json:\1 bson:\1/' ./*.pb.go
-i:直接修改读取的文件内容,而不是输出到终端。-E:使用正则表达式s/regexp/replacement/:使用replacement替换regexp中的内容,其中正则内容可以使用\1到\9表示./*.pb.go:需要进行替换的文件未知和文件名