To save the grep, you can do:
sed -Ene 's/^location: (.*)?utm.*$/\1/p'
If you've got a newer `curl`, you can just print the header: curl -I -s -o /dev/null -w '%header{location}' <url>
But you'll obviously still need the sed if you want to trim off the UTM cruft. Unless you want to go the route of `bash` substitutions. l="$(curl -I -s -o /dev/null -w '%header{location}' <url>)"
echo "${l%%?utm*}"