我有以下內容的兩個文本文件:數據整合
FILE1.TXT:
ProcessId VirtualSize
5752 74649600
3932 76843610
1357 90215638
& so on....
FILE2.TXT:
Notepad.exe pid: 3932 Linux
Notepad.exe pid: 1357 Macos
Notepad.exe pid: 5752 Windows
& so on....
現在作爲,我們可以看到進程id在兩個文件中都是相同的(匹配),所以我想要生成一個統一的單個輸出文件(匹配processId在兩個文件),它應該具有以下內容:
Output.txt的:
Windows 74649600
Linux 76843610
Macos 90215638
& so on....
我下面嘗試,它的運行,但沒有得到所需的輸出:
@echo off
(for /f "skip=1 tokens=1,2" %%a in (file1.txt) do (
for /f "tokens=5" %%c in ('find " %%a " ^< file2.txt ') do echo %%c %%b
))>Output.txt
EDIT1: 什麼我應該添加,如果我想修復/設置'Output.txt'的前兩行爲字符串永遠:
This output is for first server
Applcation Memory(GB)
即:
Output.txt的:
This output is for first server
Applcation Memory(GB)
Windows 74649600
Linux 76843610
Macos 90215638
& so on....
running..but沒有輸出..! – Sunny
有一個多餘的開放括號。你可以嘗試沒有'>> out.txt'看看會發生什麼? – npocmaka
否輸出它的生成... :( – Sunny