12/08/2011 Leave a comment
When I posted Bash-Fu: Replacing text in multiple files in one line, I knew that there would be a simpler way to achieve that. Thanks to my former colleague Ben, here is an even simpler way that uses a perl command.
$ perl -p -i -e 's/0.6-SNAPSHOT/0.7-SNAPSHOT/g' `find ./ -name pom.xml`
This command replaces the occurences of 0.6-SNAPSHOT with 0.7-SNAPSHOT in all the pom.xml files in the current directory and sub-directories. It is the usage of the find command that provides the list of files to process to the perl command.
Pay attention to the ` that surround the find command. These are not quotes but accents.