我有一个包含内容的文本文件:
process.exe Pid:4513
G:\data\Windows
process.exe Pid:6754
G:\data\Linux
process.exe Pid:4328
G:\data\MacOS
我想要一个批处理脚本:
Searches for 1st occurrence of 'process.exe' and then searches for 1st occurrence of any one of the 'Windows/Linux/MacOS' word and let's assume Windows word found then send the following output to a text file 'Output.txt' :
process.exe Pid:4513 Windows
Then searches for 2nd occurrence of 'process.exe' and then searches again for 1st occurrence of any one of the 'Windows/Linux/MacOS' word and let's assume Linux word found then send the following output to the same text file 'Output.txt' :
process.exe Pid:6754 Linux
and so on..
最后,“Output.txt”文件应包含以下内容:
process.exe Pid:4513 Windows
process.exe Pid:6754 Linux
process.exe Pid:4328 MacOS