Make flat_cp tool portable to systems without GNU sed