-1

你能告诉我如何按第一个数字对每个段落进行排序,如下所示:

14  Time=110.07s (1541s)  Lock=0.00s (0s)  Rows=0.1 (1), afadil[afadil]@economiste-www.avantis.pl
  SELECT t.word AS realword, i.word FROM search_total t LEFT JOIN search_index i ON t.word = i.word WHERE i.word IS NULL

10  Time=56.60s (566s)  Lock=0.00s (0s)  Rows=14.6 (146), afadil[afadil]@economiste-www.avantis.pl
  SELECT n.nid FROM node n LEFT JOIN search_dataset d ON d.type = 'S' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> N ORDER BY d.reindex ASC, n.nid ASC LIMIT N, N

1  Time=51.00s (51s)  Lock=0.00s (0s)  Rows=0.0 (0), afadil[afadil]@economiste-www.avantis.pl
  SELECT SUM(i.score * t.count) AS score FROM search_index i INNER JOIN search_total t ON i.word = t.word INNER JOIN node n ON n.nid = i.sid  INNER JOIN search_dataset d ON i.sid = d.sid AND i.type = d.type WHERE n.status = N AND ( n.type NOT IN ('S','S','S','S','S','S','S','S','S','S','S','S','S','S','S','S','S','S','S','S','S','S','S','S') ) AND (i.word = 'S' OR i.word = 'S' OR i.word = 'S' OR i.word = 'S' OR i.word = 'S') AND i.type = 'S' AND (d.data LIKE 'S' AND d.data LIKE 'S' AND d.data LIKE 'S' AND d.data LIKE 'S' AND d.data LIKE 'S' AND d.data LIKE 'S' AND d.data LIKE 'S' AND d.data LIKE 'S' AND d.data LIKE 'S') GROUP BY i.type, i.sid HAVING COUNT(*) >= N ORDER BY score DESC LIMIT N, N

这是一个mysql日志,所以我想整理一下,每一行都以一个数字开头。先感谢您。

4

1 回答 1

3

如果您的每个条目都是一行,则应该这样做:

%sort! n

这对第一个数字进行排序n,并将!排序顺序反转为降序。

由于格式是每个数据集三行,我首先:join将它们放在一起:

:%g/^\d/join 3

动态(非固定行号)段落的连接将是

:%g/^\d/normal! V}J

(逐行视觉模式,到下一段,Join)。

如果需要保留单独的行,可以在排序后使用:substitute(带\r替换)再次拆分它们。

于 2013-10-10T09:46:08.973 回答