Rely on perl to do substitution, as sed is not coherent between linux and darwin.
Make test more resilient to platform changes.