Reputation:
I am trying do the following:
find . -iname pom.xml
| xargs sed -i
"s/<version>${project.version}</version>/<version>0.9.1-SNAPSHOT</version>/g"
But it doesn't work. What all I need to escape here?
I tried multiple combinations like escaping /
in version and $
.
Upvotes: 1
Views: 768
Reputation: 8072
The match string you want is <version>\${project\.version}<\/version>
(escape the $
, the .
, and the /
). The replace string you want is <version>0.9.1-SNAPSHOT<\/version>
(escape the /
).
Combined that yields:
"s/<version>\${project\.version}<\/version>/<version>0.9.1-SNAPSHOT<\/version>/g"
Upvotes: 0
Reputation: 63698
Escape $
and .
. Use different delimiter(;
).
sed "s;<version>\${project\.version}</version>;<version>0.9.1-SNAPSHOT</version>;g"
Upvotes: 5