Fix sed calls to use the -E flag

Make the sed call portable across GNU and BSD implementations.