$columns = import-csv C:\infile.csv -Header 'column1','column2','column3','column4' -Delimiter ';' $Result = @() ForEach($i in $columns){ $found = 0; ForEach($m in $Result){ if($m.column1 -eq $i.column1){ $found = 1 if( $i.column4.length -ne 0 ) { $m.column4 = $i.column4 } break; } } if($found -eq 0){ $Result += [pscustomobject] @{column1=$i.column1; column2=$i.column2; column3=$i.column3; column4=$i.column4} } } $Result | export-csv C:\out.csv
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter