Replacing proto path using REGEX

Find & replace “import paths” in .proto files:

The following command will replace the text ‘enums/’ to ‘enums’ removing the forward slash in the entire directory consisting of .proto files.

NOTE: Make sure to give the complete text while searching to replace appropriately at the desired locations.

find ./ -name \*.proto -exec sed -i “s;enums/;\\enums;g” {} \;

s;enums/;\\enums;g

The text ‘enums/’ is the text to find in the proto files & the ‘enums’ text after the double back slash is the one to be replaced.

Leave a Reply

Your email address will not be published. Required fields are marked *