【发布时间】:2015-10-24 03:54:21
【问题描述】:
我想从这个例子中删除整个“派生词”部分,两者都是。到目前为止,我已经想出了将“派生词:”这一行之后的行与该行合并并删除它的想法,但我不能只合并以下两行,行数可能因文章而异。所以,我的想法是检查行是否与模式“^Derived words:”匹配,然后检查下一行是否与模式“^[a-z]”匹配,如果为真,连接在一起,检查下一行......听起来这项工作是完美定制的对于 Bash 的 if-then-else,但如果可能的话,我更喜欢纯 sed 解决方案。
A swift event or process happens very quickly or without delay.
Our task is to challenge the UN to make a swift decision...
The police were swift to act.
Syn:
quick
Derived words:
swiftly The French have acted swiftly and decisively to protect their industries.
swiftness The secrecy and swiftness of the invasion shocked and amazed army officers.
Something that is swift moves very quickly.
With a swift movement, Matthew Jerrold sat upright.
Syn:
quick
Derived words:
swiftly ^[[0;37m...a swiftly flowing stream.
swiftness With incredible swiftness she ran down the passage.
A swift is a small bird with long curved wings.
预期结果
A swift event or process happens very quickly or without delay.
Our task is to challenge the UN to make a swift decision...
The police were swift to act.
Syn:
quick
Something that is swift moves very quickly.
With a swift movement, Matthew Jerrold sat upright.
Syn:
quick
A swift is a small bird with long curved wings.
提前致谢
【问题讨论】:
-
重要的是定义关闭
Derived words:块的内容。这可以通过正则表达式定义吗?我看到你选择的下一个词是“快速移动……”,这是为什么呢?试着自己回答这个答案并做一些尝试! -
"With a swift movement..." 是一个用法示例,应该保持原样。