文件1:
hello
- dictionary definitions:
hi
hello
hallo
greetings
salutations
no more hello for you
-
world
- dictionary definitions:
universe
everything
the globe
the biggest tree
planet
cess pool of organic life
-
我需要将此(对于大量单词列表)格式化为术语到定义格式(每个术语一行)。怎么能做到这一点?没有一个词是相同的,只有上面看到的结构是相同的。结果文件看起来像这样:
hello - dictionary definitions: hi hello hallo greetings salutations no more hello for you -
world - dictionary definitions: universe everything the globe the biggest tree planet cess pool of organic life -
Awk/Sed/Grep/Cat 是通常的竞争者。