This question already has an answer here:
I'm trying to use sed to remove any subdomain prefix from a list of hostnames, but it's not replacing anything when I use a regular expression. Here's the simplified example that's not working:
echo "subdomainxyz.example.com" | sed 's/[a-z]+\.example\.com//'
When I hard-code a particular subdomain in there, it works just fine:
echo "subdomainxyz.example.com" | sed 's/subdomainxyz\.example.com/example.com/'