Fix iconv/intl linking
Replace 'grep -o' calls with a portable sed call