次の内容の 2 つのテキスト ファイルがあります。
ファイル1.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 が一致) を生成したいと考えています。
出力.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」の最初の2行を文字列で永遠に修正/設定したい場合は、何を追加すればよいですか:
This output is for first server
Applcation Memory(GB )
すなわち:
出力.txt:
This output is for first server
Applcation Memory(GB)
Windows 74649600
Linux 76843610
Macos 90215638
& so on....