用于url的GREP REGEX,具有特定的开头和结尾,中间有随机值

用于url的GREP REGEX,具有特定的开头和结尾,中间有随机值,regex,grep,regex-negation,Regex,Grep,Regex Negation,我在为我的grep命令编写正则表达式时遇到问题。我有一大堆html页面需要搜索才能找到所有youtube.com链接。更重要的是,我只需要那些不以rel=0结尾的youtube链接 例如: http://www.youtube.com/(something)_rel=0 [i have a regex for this] http://www.youtube.com/(something) [i need this one] 这可能吗?使用此grep: grep -i

我在为我的
grep
命令编写正则表达式时遇到问题。我有一大堆html页面需要搜索才能找到所有
youtube.com
链接。更重要的是,我只需要那些不以
rel=0
结尾的youtube链接

例如:

http://www.youtube.com/(something)_rel=0    [i have a regex for this]

http://www.youtube.com/(something)          [i need this one]
这可能吗?

使用此grep:

grep -i "youtube\." infile | grep -iv "rel=0$"