johnnyjonathan
asked on
Looking for a script to compare 3 text files and run a command in case they match
Hi,
I'm looking for a script (could be vb\power shell\batch) to compare between 3 text files, they only have a numeric value in them, in case all files match, then run a command
Any advise please?
I'm looking for a script (could be vb\power shell\batch) to compare between 3 text files, they only have a numeric value in them, in case all files match, then run a command
Any advise please?
Please try this
Note sure what really required, from your question a you might looking for this, or you can derive the one you require from this
========================== ========== ========== ========== ========
$a=get-content .\files1.txt
$b=get-content .\files2.txt
$c=get-content .\files3.txt
$first = Compare-Object $a $b
$last = Compare-Object $a $c
if ($first -eq $Null -and $last -eq $Null)
{
Write-Host "All file match"
#{Execute your Command here}
}
elseif ($first -eq $Null)
{
Write-host "last two files not matching"
}
else
{
Write-host "First two file not matching"
}
++++++++++++++++++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++
Note sure what really required, from your question a you might looking for this, or you can derive the one you require from this
==========================
$a=get-content .\files1.txt
$b=get-content .\files2.txt
$c=get-content .\files3.txt
$first = Compare-Object $a $b
$last = Compare-Object $a $c
if ($first -eq $Null -and $last -eq $Null)
{
Write-Host "All file match"
#{Execute your Command here}
}
elseif ($first -eq $Null)
{
Write-host "last two files not matching"
}
else
{
Write-host "First two file not matching"
}
++++++++++++++++++++++++++
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect!
Thank you!
Thank you!
http://www.sourcegear.com/diffmerge/