- 论坛徽章:
- 0
|
怎样快速删除超大文件中的行
原帖由 "bjgirl" 发表:
vim -e -s -c ":n,m,jd" -c ":wq" urfile
其中,n,m,j...代表不同的行号,d表示删除
有BUG。。。
- $ more oldfile
- 1 # /etc/services:
- 2 # $Id: services,v 1.31 2002/04/03 16:53:20 notting Exp $
- 3 #
- 4 # Network services, Internet style
- 5 #
- 6 # Note that it is presently the policy of IANA to assign a single well-known
- 7 # port number for both TCP and UDP; hence, most entries here have two entries
- 8 # even if the protocol doesn't support UDP operations.
- 9 # Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports
- 10 # are included, only the more common ones.
复制代码
$ vim -e -s -c ":2,4,6d" -c ":wq" oldfile
- $ more oldfile
- 1 # /etc/services:
- 2 # $Id: services,v 1.31 2002/04/03 16:53:20 notting Exp $
- 3 #
- 7 # port number for both TCP and UDP; hence, most entries here have two entries
- 8 # even if the protocol doesn't support UDP operations.
- 9 # Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports
- 10 # are included, only the more common ones.
复制代码
结果不一样啊。。 |
|