converted the sed command to perl in order to make the substitution a little easier on the brain