Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个文件包含许多以 a 结尾的单词.,其中大部分是缩写,例如:
.
我怎样才能输出一个显示所有这些单词的列表,只显示一次?
其中一种方法是:
egrep -o '\b[^ ]+\.' < list_of_words | sort | uniq
如果您有 GNU grep,请利用与 Perl 兼容的正则表达式:grep -Po '\S*\.(?=$|\s)'
grep -Po '\S*\.(?=$|\s)'
你可以做:
egrep -io ' [a-z.]+\.' input_file | sort -u