删除vi中的重复行? [英] Removing duplicate rows in vi?

查看:145
本文介绍了删除vi中的重复行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本文件,其中包含一长串条目(每行一个)。其中一些是重复的,我想知道是否可能(如果是,如何)删除任何重复。如果可能,我有兴趣在vi / vim内执行此操作。

解决方案

如果可以对文件进行排序,您可以使用:

 :sort u 


I have a text file that contains a long list of entries (one on each line). Some of these are duplicates, and I would like to know if it is possible (and if so, how) to remove any duplicates. I am interested in doing this from within vi/vim, if possible.

解决方案

If you're OK with sorting your file, you can use:

:sort u

这篇关于删除vi中的重复行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆