#!/bin/bash s='URL:http://t...content-available-to-author-only...d.internal .Response code: 503> ' sed 's~\(https\{0,1\}://\)[^.]\{1,\}~\1hostname~' <<< "$s" sed -E 's~(https?://)[^.]+~\1hostname~' <<< "$s"
Standard input is empty
URL:http://h...content-available-to-author-only...d.internal .Response code: 503> URL:http://h...content-available-to-author-only...d.internal .Response code: 503>