Match and Update Csv

Welcome Forums General PowerShell Q&A Match and Update Csv

This topic contains 1 reply, has 1 voice, and was last updated by

 
Participant
3 years, 10 months ago.

  • Author
    Posts
  • #24165

    Participant
    Points: 0
    Rank: Member

    Hello

    I am working with a Csv master list. After gathering data and exporting it to a "working set "csv list Id like to update my master list by matching computer names and update my 'online' field

    any help would d be greatly appreciated.

    heres what I have so far

    $master = "C:\MasterList.csv"
    $working = "C:\workingset.csv"
    
    $masterlist = ipcsv $master
    $workingset = ipcsv $working
    
    
    
     $Output = foreach ($m in $masterlist) {
        foreach ($w in $workingset) {
            if ($m.computername -like "*$($w.computername)*") { $m.online = $w.online }
       
        }
        $i
    }
    $Output | Export-Csv $CsvFile -NoTypeInformation
    
  • #24166

    Participant
    Points: 0
    Rank: Member

    I solved the issue I needed to remove $output and add

    $masterlist | Export-Csv $master -NoTypeInformation

The topic ‘Match and Update Csv’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort