I try to merge to files with Compare-Object
and I got a file like this:
Number=5
Example=4
Track=1000
Date=07/08/2018 19:51:16
MatCaissierePDAAssoc=
NomImpPDAAssoc=
TpeForceLectPan=0
Number=1
Example=1
Track=0
Date=01/01/1999
You can see it repeats with Number=1. Except with a different value. I would like to delete everything (everything means not only "= 1") after my keyword "Number" and my keyword itself.
This is what I did so far:
$files = Get-ChildItem "D:\all"
foreach ($file in $files) {
$name = dir $file.FullName | select -ExpandProperty Name
Compare-Object -ReferenceObject (Get-Content D:\original\test.ini) -DifferenceObject (Get-Content $file.FullName) -PassThru |
Out-File ('D:\output\' + $name)
}
And I would like to delete all lines with "Track" and "Date".
My Result should look like this:
Number=5
Example=4
MatCaissierePDAAssoc=
NomImpPDAAssoc=
TpeForceLectPan=0
In fact I need something to delete double keys in my file.