#!/bin/bash
s='66.249.76.98 - - [12/Aug/2016:06:26:33 +0200] "GET /kod-exempel/dynamic_php_menu/ HTTP/1.1" 301 3859 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"'
sed -n 's~.*\(https\{0,1\}://[^/]*\).*~\1~p' <<< "$s"