Thursday, April 19, 2012

find and replace in place

With our current project structure we are constantly having to jump across versions. Simplest way for in place replacement.

For e.g. to find and replace all snapshot versions in pom.xml

find . -name 'pom.xml' -print0 | xargs -0 sed -i 's/3.1.0-SNAPSHOT/3.1.4-SNAPSHOT/g'

or

find . -name 'pom.xml' -exec sed -i 's/3.1.4-SNAPSHOT/3.1.5-SNAP/g' {} \;

No comments: