I am trying to replace submodules from .gitmodules repo with repo-name using below script. This script is created by other team. Is there a way I can satisfy the output of before command to satisfy the sed.
echo "submodule.repo.path" | sed -nE 's/^submodule\.src/(.*)\.path$/\1/pi'
Above command failing with an error:- sed: 1: "s/^submodule\.src/(.*)\ ...": bad flag in substitute command: '\'
Correct to:
echo "submodule.src/repo.path" | sed -nE 's/^submodule\.src\/(.*)\.path$/\1/pi'
You failed to escape a slash in your search, which caused your replacement to be (.*)\.path$
and your flags \1/pi
; sed
is complaining these are not legal flags for s//
command.
(Also, the pattern did not match the test string, so I changed the test string to something that does.)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments