I have to write a sed script which removes http and https from a URL. So if
a URL is https://www.example.com or Example Web Page, script should return me Example Web Page
i tried echo $url | sed 's|^http[s]://||g'. It doesn't work. Please help
I have to write a sed script which removes http and https from a URL. So if
a URL is https://www.example.com or Example Web Page, script should return me Example Web Page
i tried echo $url | sed 's|^http[s]://||g'. It doesn't work. Please help
echo 'https://www.example.com' |sed 's/https\?:\/\///'
echo "https://www.example.com" | sed 's~http*://~~g'
Based on your own approach:
sed 's/^http\(\|s\):\/\///g'
Or, less geeky, less cryptic:
sed -e 's/^http:\/\///g' -e 's/^https:\/\///g'
try
-bash-3.00$ echo $site
https://www.example.com
-bash-3.00$ echo ${site#*//}
www.example.com
-bash-3.00$