Having some issues with the syntax. I'm trying to copy the variable value into another csv column.
$file1 = import-csv C:\temp\csv1.csv
$file2 = import-csv C:\Temp\csv2.csv
$file3 = import-csv C:\Temp\csv3.csv
foreach ($line in $file1) {
foreach ($row in $file2) {
if ($line.col1 -eq $row.col1){
#this is the part im having issues with:
$row.col2 = $line.col3 | Export-Csv #???
}
}
}
$rowis a reference to an object in$file2. When you update$row,$file2is automatically updated. Therefore, you can just wait until you have made all your updates. Then export to CSV at the end -->$file2 | Export-Csv ....