Tuesday, April 21, 2015

Compare 2 CSV files and store result in 3rd CSV file using PowerShell

Below script is to compare 2 CSV files and store result in 3rd CSV file using PowerShell,

$file1 = Import-CSV -Path "C:\A.CSV" 
$file2 = Import-CSV -Path "C:\B.CSV"

$result = Compare-Object -ReferenceObject $file2 -DifferenceObject $file1 -Property List_URL -PassThru

If ($result) {
    $result | Export-CSV C:\C.csv -NoTypeInformation
}

Select and Delete text vertically in bigger text OR flat file

If you want to Select and Delete text vertically in bigger text OR any flat file use below command to do it. Example below: A BCEDF CDEF...