Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要两个匹配项:Campus 和 Mode,但以下代码仅获取 Campus:
sed -n 's/.*<th colspan="7">Campus:\(.*\)<br \/> Mode:\(.*\)<\/th><\/tr>.*/\1/p'
由于您的替换字符串仅包含\1反向引用,因此它只会打印第一个匹配的组,即来自Campus:\(.*\). 尝试将替换字符串更改\1 \2为包含两者...
\1
Campus:\(.*\)
\1 \2