changed sed replace regexp which supports both MacOS and unix based OSs