Excel 将第二行移动到第三行的末尾//记事本++;

Excel 将第二行移动到第三行的末尾//记事本++;,excel,notepad++,vba,Excel,Notepad++,Vba,我有以下txt文件,其中包含一个由三行组成的块并重复(总共4000行): 现在我想把第二行移到第三行的末尾,然后重复(第五行到第六行的末尾;第八行到第九行的末尾,依此类推) 有没有可能用记事本++来实现这一点?或者Excel宏?我发现了一些关于regex和vmi的例子,但问题是他们在寻找关键字。我只想把整个第二行移到第三行的末尾。。。然后继续这个模式(第五->第六;第八->第九) 非常感谢您的任何意见/想法/解决方案 问候 米奇好吧,有时候一点时间带来一些想法:) 我刚刚在Excel中导入了tx

我有以下txt文件,其中包含一个由三行组成的块并重复(总共4000行):

现在我想把第二行移到第三行的末尾,然后重复(第五行到第六行的末尾;第八行到第九行的末尾,依此类推)

有没有可能用记事本++来实现这一点?或者Excel宏?我发现了一些关于regex和vmi的例子,但问题是他们在寻找关键字。我只想把整个第二行移到第三行的末尾。。。然后继续这个模式(第五->第六;第八->第九)

非常感谢您的任何意见/想法/解决方案

问候


米奇

好吧,有时候一点时间带来一些想法:)

我刚刚在Excel中导入了txt文件,所以第1行是“Printer1”,第2行是“/900”,依此类推。 然后我就这样做了:

B1 =A1
B2 =A3&A2
B3 =empty
然后我将B1标记为B3,并用ctrl键将其拖动到文件末尾。瞧,我有我需要的。现在我将把B列复制到新的txt文件中,一切正常:)

  • Ctrl+H
  • 查找内容:
    ^.+\R\K(+.+\R)(.+\R)
  • 替换为:
    $2$1
  • 检查环绕
  • 检查正则表达式
  • 不要选中
    。匹配换行符
  • 全部替换
说明:

^           : beginning of line
  .+        : 1 or more any character but newline (ie. the first line)
  \K        : forget all we have seen until this position
  (.+\R)    : Group 1, 1 or more any character followed by linebreak (ie. the second line)
  (.+\R)    : Group 2, 1 or more any character followed by linebreak (ie. the third line)
$2      : content of group 2
$1      : content of group 1
Printer1
HBA/8/7
/900
Printer2
HBA/7/2
/800
更换:

^           : beginning of line
  .+        : 1 or more any character but newline (ie. the first line)
  \K        : forget all we have seen until this position
  (.+\R)    : Group 1, 1 or more any character followed by linebreak (ie. the second line)
  (.+\R)    : Group 2, 1 or more any character followed by linebreak (ie. the third line)
$2      : content of group 2
$1      : content of group 1
Printer1
HBA/8/7
/900
Printer2
HBA/7/2
/800
给定示例的结果:

^           : beginning of line
  .+        : 1 or more any character but newline (ie. the first line)
  \K        : forget all we have seen until this position
  (.+\R)    : Group 1, 1 or more any character followed by linebreak (ie. the second line)
  (.+\R)    : Group 2, 1 or more any character followed by linebreak (ie. the third line)
$2      : content of group 2
$1      : content of group 1
Printer1
HBA/8/7
/900
Printer2
HBA/7/2
/800