【发布时间】:2020-11-06 13:52:55
【问题描述】:
有没有办法使用 grep、sed 或 awk 将每个单词的索引放在单词旁边(或者有没有内置此功能的软件)?
例如,给定以下文本:
"I love the power of Grep SED and AWK, but I am no good at using it"
我想要这个:
"I(1) love(2) the(3) power(4) of(5) Grep(6) SED(7) and(8) AWK,(9) but(10) I(11) am(12) no(13) good(14) at(15) using(16) it(17)"
澄清:"I" 排在第一位得到"(1)","it" 排在最后17 个字得到"(17)"。
【问题讨论】:
-
为什么要在此处重新发布,biostars 的答案是否不明确/足够? biostars.org/p/449890
-
接近投票者,请重新考虑,帖子足够清晰。