Fix GNU vs BSD sed compatibility