In requirements.txt
, I want to replace the branch/commit which can contain forward slashes, dashes, and other potentially special characters that may need escaping:
-e [email protected]:acme-inc/repo0.git@master#egg=repo0
-e [email protected]:acme-inc/repo1.git@master#egg=repo1
-e [email protected]:acme-inc/repo2.git@master#egg=repo2
An example goal is to replace the content between @ and # with an arbitrary branch or commit. For example:
-e [email protected]:acme-inc/repo0.git@my/branch/0#egg=repo0
-e [email protected]:acme-inc/repo1.git@1234567#egg=repo1
-e [email protected]:acme-inc/repo2.git@my/branch-2#egg=repo2
This is NOT producing the desired goal's 0th row:
sed -i 's/(repo0.git@).*(#)/"my/branch/0"/' testfile.txt
Related:
repo0
yet your example replaces on therepo1
line.1234567
in your example?