我有如下示例数据:
line1
line2
line3
line4
line5
line6
而且,我想让它看起来像这样:
line2
line1
line4
line3
line6
line5
答案1
以下是一种方法:
- Ctrl+H
- 找什么:
(^.+)(\R)(^.+)\R?
- 用。。。来代替:
$3$2$1$2
- 查看 环绕
- 查看 正则表达式
- 取消选中
. matches newline
- Replace all
解释:
(^.+) # group 1, first line
(\R) # group 2, any kind of inebreak
(^.+) # group 3, second line
\R? # optional linebreak
替代品:
$3 # second line
$2 # same linebreak as original
$1 # first line
$2 # same linebreak as original
截图(之前):
截图(之后):