#!/bin/bash updatePom() { cat $1 | xsltproc -o $1 /tmp/rebase-pom.xslt - } export -f updatePom # Create XSLT script newVersion=$2 echo "newVersion is $newVersion" cat < /tmp/rebase-pom.xslt $newVersion END if [ $# -ne 2 ] then echo "Usage: $0 " exit 1 fi find $1 -name pom.xml -exec bash -c 'updatePom "$0" $1' '{}' \; #Adding single empty line before project tag if there is a header available find $1 -name pom.xml -exec sed -i '' '$!N;s@-->\n\ \