Category Archives: Perl

Replacing a text within a file in place

Recently I had to replace some text within a file, I also wanted this to occur in place. I ended up with two solutions. Mainly because of the Solaris version. But also because I wanted to play with Groovy again.

1. Perl on the commandline

perl -pi -e 's/1.2-SNAPSHOT/1.2/g' pom.xml

2. Using Groovy
Refer to Groovy: Writing to a File