Monthly Archives: July 2014

OS X + Sed: “extra characters at the end of l command” Error


When executing the following command on OS X…

sed -i 's/megatron/pony/g' /path/to/file.txt

… the following error occurs:-

sed: 1: "/path/to/file.txt": extra characters at the end of l command


Unlike Ubuntu, OS X requires the extension to be explicitly specified. The workaround is to set an empty string:-

sed -i '' 's/megatron/pony/g' /path/to/file.txt

… and now, Megatron has transformed into a pony.

Maven: Unable to Execute Spock Specs


When running mvn clean test, Maven Surefire Plugin doesn’t pick up *Spec.groovy test files.


By default, Maven Surefire Plugin is configured to execute test files with the following patterns: **/Test*.java, **/* and **/*

To fix this, we need to modify the inclusion list for this plugin. Since both Java and Groovy files get compiled down to *.class, it is probably easier to just include *.class instead of *.java or *.groovy.