windows - 读取日志文件并获取列中的行而不是行

标签 windows svn batch-file logging

有一个日志文件并希望将行读入 Excel 的单行列中。 目前,它们成排堆叠。我想将 3 行反向堆叠为一行 3>2>1

FOR /F "delims=~" %%a in (svn.log)  echo %%a  
set col3 = %%a 
echo col3 col2 col1

有没有简单的方法来做到这一点?

输入日志:>>>>

LINE#1 >r132852 | USERID | 2014-05-14 11:57:38 -0700 (Wed, 14 May 2014) | 3 lines
LINE#2 >>>Changed paths:
   M /Customer/lag/inilib/ASIPS_4600.ini
   M /Customer/lag/inilib/ASIPS_4600_TEXT_SEARCH.ini

LINE#3>> Connections tab in Plan Authoring and WO Execution.
LINE#4>> Ques ID: QUES-806 

输出日志:>>>

LINE#4>> Ques ID: QUES-806 LINE#1 >>> r132852 | USERID | 2014-05-14 11:57:38 -0700 (Wed, 14 May 2014) | 3 lines LINE#2 >>>>Changed paths: M /Customer/lag/inilib/ASIPS_4600.ini M /Customer/lag/inilib/ASIPS_4600_TEXT_SEARCH.ini LINE#3 >>> Connections tab in Plan Authoring and WO Execution. ***

输出应该在列中的 1 条直线中

Input log:
------------------------------------------------------------------------
r132994 | Userid | 2014-05-19 06:22:51 -0700 (Mon, 19 May 2014) | 3 lines
Changed paths:
M /Customer/Company/IPS/lag/message/ASIPSI_MISSING_PAGE.sql
M /Customer/Company/IPS/lag/message/ASIPSI_MISSING_WORK_ORDER.sql
M /Customer/Company/IPS/lag/message/ASIPSI_MISSING_WORK_PLAN.sql

Added messages in try catch to display to the user in case objects do not exist any longer
Ques ID: ASIPS-1003
------------------------------------------------------------------------
r132960 | Userid | 2014-05-17 03:18:09 -0700 (Sat, 17 May 2014) | 3 lines
Changed paths:

modified the command on the product Nodes tab to display either the WO or the page
Ques ID: ASIPS-1003
------------------------------------------------------------------------
r132879 | Userid | 2014-05-15 01:18:32 -0700 (Thu, 15 May 2014) | 4 lines
Changed paths:
M /Customer/Company/IPS/lag/udvlib/ASIPSI_541CA51A7CCB439FB318B8482E380F78.sql

I have forgotten to remove the two buttons I have created for the merge PDF demo. 

Ques ID: ASIPS-1003
------------------------------------------------------------------------
r132878 | Userid | 2014-05-15 01:05:10 -0700 (Thu, 15 May 2014) | 4 lines
Changed paths:
 M /Customer/Company/IPS/lag/udvlib/ASIPSI_541CA51A7CCB439FB318B8482E380F78.sql

Correction of the Tag property for button [Display Object].

Ques ID: ASIPS-1003
------------------------------------------------------------------------
r132834 | Userid | 2014-05-14 09:05:13 -0700 (Wed, 14 May 2014) | 3 lines
Changed paths:
M /Customer/Company/IPS/lag/udvlib/ASIPSI_541CA51A7CCB439FB318B8482E380F78.sql

Display Object in Tab Page Nodes doesn’t display the work order when node type is KO.
Ques ID: ASIPS-1003

需要的输出:

Ques ID: ASIPS-1003,  
r132994 | Userid | 2014-05-19 06:22:51 -0700 (Mon, 19 May 2014) | 3 lines
Changed paths:
M /Customer/Company/IPS/lag/message/ASIPSI_MISSING_PAGE.sql
M /Customer/Company/IPS/lag/message/ASIPSI_MISSING_WORK_ORDER.sql
M /Customer/Company/IPS/lag/message/ASIPSI_MISSING_WORK_PLAN.sql

Added messages in try catch to display to the user in case objects do not exist any longer
------------------------------------------------------------ 
-------------------------------          

以 QUES 开头的每一行都应该像以前一样在 CSV 文件中跨行,只是有多个修订版和 QUES ID

最佳答案

在示例文件上测试:

@echo off
< svn.log (
set /p a=
set /p b=
set /p c=
set /p d=
)

for %%a in ("%d%,%c%,%b%,%a%") do >newfile.csv echo %%~a
pause

关于windows - 读取日志文件并获取列中的行而不是行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23700347/

相关文章:

windows - 用户桌面上的隐藏窗口显示

python - 在Python中退出程序时如何打开另一个程序?

windows - 用 bat 更改 PATH 变量?

powershell - 创建批处理文件以启用 PS 脚本执行并使用行命令启动提升的 PS shell

windows - 如何将基于列表(txt)的文件批量复制到具有相同目录结构的另一个文件夹?

windows - 如何在 Windows 10 上安装 MinGW 64

c++ - 崩溃转储中的异常

Svn 错误 "Previous operation has not finished"

svn - TortoiseSVN 工作,但命令行 svn 不起作用?

c++ - 我如何打开这个应用程序是 visual studio 以便我可以运行代码?