7
单纯的学术性,但令我感到沮丧。用sed删除一行中的重复单词
我要纠正这样的文字:使用SED
there there are are multiple lexical errors in this line line
。我有这么远:
sed 's/\([a-z][a-z]*[ ,\n][ ,\n]*\)\1/\1/g' < file.text
它纠正除了最后加倍的单词之外的所有内容!
there are multiple lexical errors in this line line
请问sed guru请解释为什么上面的内容不涉及到底是什么话?
注: RE - '[,\ n]'sed使用'\ n'作为行分隔符。因此,除非在模式空间中插入'\ n',否则在向模式空间读入一行后,您将永远不会遇到它们。 – potong