我正在尝试将 2 个 CSV 文件与 (logs_all, logs_new) 格式的日志信息进行比较:
我想从 logs_new 添加它们在 logs_all 中不存在的行
$csv1 = Import-Csv $csvLogs_all -Delimiter "`t"
$csv2 = Import-Csv $csvLogs_new -Delimiter "`t"
$end = $csv1.Count
$count = 0
$diffobj = @()
# testtable is the name of the column, adjust it to your column header name
if($csv1.time[$count] -ne $csv2.time){
$diffobj += $csv2[$count]
}
$count++
}until($count -eq $end)
Write-Host "chekking logs"
$diffobj | export-csv $csvLogs_all -NoTypeInformation
但这不是很好,有人可以帮助我吗?