Regex 返回一个正则表达式匹配,不包括部分匹配
假设我有一个Twiki页面,其来源如下:Regex 返回一个正则表达式匹配,不包括部分匹配,regex,grep,Regex,Grep,假设我有一个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
| *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 |
我想构造一个正则表达式模式,它应该匹配后面的所有内容
更新*|
这是个简单的问题,伙计们 如果egrep是指*nix中的egrep二进制文件,则可以执行以下操作:
egrep -o "\*Update\*.*" <<< $(<file)
这就是你想要的吗
awk 'o;/\*Update\* \|$/{o=1}' yourFile
输出
但更新后没有任何内容*|。你能发布你想要的输出吗?|区域1 | Olaf | RedHat |类型1 |主题1 |时间1 |进度| TBC |区域2 | Olaf | Gentoo |类型2 |主题2 |时间2 |无事|为什么不删除第一行?我想剩下的就是你想要的。对不起,我不明白你的意思。。。删去删除源当然不是一个选项!!!我必须匹配东西,而不是改变东西。
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 |