如何基于grep与正则获取Ubuntu全部镜像站列表?
# 获取Ubuntu官方镜像列表的URL
ubuntu_mirror_url="https://launchpad.net/ubuntu/+archivemirrors"
# 通过grep与正则表达式匹配全部镜像的URL
wget -qO- "$ubuntu_mirror_url" \
| grep -oE '(http|https).*(http</a>|https</a>)' \
| cut -d '"' -f1 > ubuntu_mirror_url_list.txt
# 匹配中国的镜像地址(需要时可选)
cat ubuntu_mirror_url_list.txt | grep -E '(edu.cn|aliyun)'