powershell
compare two files
set-Executionpolicy unrestricted
# above allows it to run
$readthefile = (Get-Content c:\nigel.txt)
$readthefiletwo = ((Get-Content c:\nigel2.txt))
write customers that exist in both > c:\out.txt
#read each line of file 1 nigel
# outer loop
foreach ($i in $readthefile)
{
write-host TheData
write-host $i
# inner loop
write-host "I = " $i
foreach ($b in $readthefiletwo)
{
write-host "B = " $b
if ($i -eq $b)
{
write $i >> c:\out.txt
write-host I found a customer that exists in both
}
}
}
# End of Program Nigel
#write-host contents of file 1
#write-host $readthefile
#write-host contents of file 2
#write-host $readthefiletwo
set-Executionpolicy unrestricted
# above allows it to run
$readthefile = (Get-Content c:\nigel.txt)
$readthefiletwo = ((Get-Content c:\nigel2.txt))
write customers that exist in both > c:\out.txt
#read each line of file 1 nigel
# outer loop
foreach ($i in $readthefile)
{
write-host TheData
write-host $i
# inner loop
write-host "I = " $i
foreach ($b in $readthefiletwo)
{
write-host "B = " $b
if ($i -eq $b)
{
write $i >> c:\out.txt
write-host I found a customer that exists in both
}
}
}
# End of Program Nigel
#write-host contents of file 1
#write-host $readthefile
#write-host contents of file 2
#write-host $readthefiletwo


0 Comments:
Post a Comment
<< Home