Fix sed incompatibility

Based on @gkossakowski's contribution.