0
我已經使用repl.bat從文本文件中提取了幾個月的某些行。不幸的是,輸出已經改爲XML,並且它現在在XML標籤中使用了反斜槓作爲分隔符。使用repl.bat從XML中提取文本爲文本
下面是我用什麼當輸出文件是這樣的
Job Notes=John Smith 123456 dd/MM/yyyy h:mm:ss PM 654321
File Type=4
Location=3
代碼
@echo off
set "input=before.txt"
set "output=after.txt"
findstr /r /i /c:"^Job Notes=" "%input%" |repl ".*=(.*) (\d+) (\d+\/\d+\/\d+) \d+:\d+:\d+ .*" "Name=$1\r\nFile Number=$2\r\nDate=$3" x >"%output%"
findstr /r /i /c:"^File Type=" "%input%" >>"%output%"
findstr /r /i /c:"^Location=" "%input%" >>"%output%"
的輸出中現在是XML
<job_notes>John Smith\123456\dd/MM/yyyy h:mm:ss PM\654321</job_notes>
<file_type>4</file_type>
<location>3</location>
不知道這是否是問題但XML的結構是
<root>
<job>
<job_notes>xxxxxxx</job_notes>
<file_type>x</file_type>
<location>x</location>
</job>
</root>
無法獲取修改後的腳本。不確定問題是XML文件的結構還是分隔符。
由於