none
Import export an -Delimiter ';' CSV file RRS feed

  • Question

  • I've a script, which one export-csv their data in a four columns csv file.
    sometimes, they run this script for good reasons more than one time.
    To remove duplicate data from it, I try to add the below code to it

    $workDir = "\\file01\public\tmp"
    $month = (Get-Date).ToString('MMMM')
    $HF_log ="installedupdates $month.csv"
    $App_log ="installed_Applications $month.csv"
    $Export1 = "$workDir\$HF_log"
    $Export2 = "$workDir\$App_log"
    #Remove-Item $Export -Force
    $input = "$Export1"
    $inputCsv = Import-Csv $input | Sort-Object * -Unique
    
    $inputCsv | Export-Csv "$input-ALL.csv" -append -notype
    $input2 = "$Export2"
    $inputCsv2 = Import-Csv $input2 | Sort-Object * -Unique
    $inputCsv2 | Export-Csv "$input2-ALL.csv" -append
    
    

    Unfortunately, as soon I run the above section, it create a file with only one column. instead off the four as in the import-csv file.
    Hopefully one of you can tell me how I can solve this issue.

    Thanks!



    • Edited by Goudduif Monday, June 10, 2019 7:41 PM
    Monday, June 10, 2019 7:40 PM

All replies