鉴于我有一个Twiki页面,其中包含以下内容:
| *Region* | *Owner* | *Partner / Project* | *Type* | *Description* | *Timeline* | *Flag* | *Update* |
| Region 1 | Olaf | RedHat | type1 | nothing to do at topic 1 | time1 | Progress | TBC |
| Region 2 | Olaf | Gentoo | type2 | nothing to do at topic 2 | time2 | | none |
我想构建一个应该匹配
之后的所有内容的正则表达式模式更新* |
这是一个简单的问题,伙计们!
答案 0 :(得分:0)
如果通过egrep你的意思是* nix中的egrep二进制,那么你可以这样做:
egrep -o "\*Update\*.*" <<< $(<file)
<强>输出:强>
*Update* | | Region 1 | Olaf | RedHat | type1 | nothing to do at topic 1 | time1 | Progress | TBC | | Region 2 | Olaf | Gentoo | type2 | nothing to do at topic 2 | time2 | | none |
答案 1 :(得分:0)
这就是你想要的吗?
awk 'o;/\*Update\* \|$/{o=1}' yourFile
<强>输出强>
| Region 1 | Olaf | RedHat | type1 | nothing to do at topic 1 | time1 | Progress | TBC |
| Region 2 | Olaf | Gentoo | type2 | nothing to do at topic 2 | time2 | | none |