2
我有兩個文件:比較線條,使新的生產線進行比賽
文件1:
Server A sent Mail with [email protected]
Server A sent Mail with [email protected]
Server B sent Mail with [email protected]
文件2:
[email protected]
[email protected]
[email protected]
例如,如果電子郵件地址「testuser1 @ TESTDOM。 com「from file2也在file1中,它應該將這行從file1附加到新文件file3。 有沒有可能兩個有多個文件,並一步與file2進行比較?
這是我試過了,但它並不完全做我想做的:
compare (cat $file1) (cat $file2) | Out-File $file3
和這樣的:(只打印這是完全一樣的臺詞,但我需要它部分)
Get-Content $file1 | ForEach-Object {
$file1_Line = $_
Get-Content $file2 | Where-Object {$_.Contains($file1_Line)} |
Out-File -FilePath $file3 -Append
}
「它應該創建與鄂麥新文件l地址或文件1中的行「 - 您能澄清一下嗎? –
例如,如果file2中的電子郵件地址「[email protected]」也在file1中,則應將此行從file1附加到file3。 – Clam