Hi. I have two text files that are actually exports of user and computers
accounts from two domains. I would like to be able to compare the two files
for duplicate names and spit out a "report" of the unique names and duplicate
names.
Of course, I can't do a line-by-line comparison because the files don't
match up that way. It is more of a comparison of the entire contents of the
files.
Maybe logparser would do this?
Thanks!

Re: Compare text files for duplicates by NewsReader

NewsReader
Tue Jul 19 15:04:03 CDT 2005

I think you can do something like this with the FINDSTR command. For
example, to find duplicates between two files, an example command would be
something like:

FINDSTR /I /X /G:File1.txt File2.txt

"Antknee" <Antknee@discussions.microsoft.com> wrote in message
news:3B7DB1EA-1AB6-4906-8514-DAF91A88BCBC@microsoft.com...
> Hi. I have two text files that are actually exports of user and computers
> accounts from two domains. I would like to be able to compare the two
> files
> for duplicate names and spit out a "report" of the unique names and
> duplicate
> names.
> Of course, I can't do a line-by-line comparison because the files don't
> match up that way. It is more of a comparison of the entire contents of
> the
> files.
> Maybe logparser would do this?
> Thanks!



Re: Compare text files for duplicates by NewsReader

NewsReader
Tue Jul 19 15:08:26 CDT 2005

Also, if you have Microsoft Visual Studio, the WINDIFF utility may also help
you.

"NewsReader" <NewsReader@NewsReader.com> wrote in message
news:OFOdF0JjFHA.572@TK2MSFTNGP15.phx.gbl...
>I think you can do something like this with the FINDSTR command. For
>example, to find duplicates between two files, an example command would be
>something like:
>
> FINDSTR /I /X /G:File1.txt File2.txt
>
> "Antknee" <Antknee@discussions.microsoft.com> wrote in message
> news:3B7DB1EA-1AB6-4906-8514-DAF91A88BCBC@microsoft.com...
>> Hi. I have two text files that are actually exports of user and computers
>> accounts from two domains. I would like to be able to compare the two
>> files
>> for duplicate names and spit out a "report" of the unique names and
>> duplicate
>> names.
>> Of course, I can't do a line-by-line comparison because the files don't
>> match up that way. It is more of a comparison of the entire contents of
>> the
>> files.
>> Maybe logparser would do this?
>> Thanks!
>
>



Re: Compare text files for duplicates by Torgeir

Torgeir
Wed Jul 20 04:17:36 CDT 2005

NewsReader wrote:

> Also, if you have Microsoft Visual Studio, the WINDIFF utility
> may also help you.
>
Hi,

Windiff is also to be found on a Win2k/WinXP CD, in the Support Tools.

Install "Support Tools" by starting suptools.msi from
<cd-drive>\Support\Tools\

Also note that there is updated versions of Support Tools available:

Windows XP Service Pack 2 Support Tools
http://www.microsoft.com/downloads/details.aspx?FamilyID=49ae8576-9bb9-4126-9761-ba8011fabf38

After the install, you will find Windiff.exe in
%ProgramFiles%\Support Tools\


Two other free file/folder difference analysis tools:

CSDIFF
http://www.componentsoftware.com/Products/CSDiff/index.htm

FCU File-Compare Utility
http://www.geherbert.de/fcumain.html



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Re: Compare text files for duplicates by Csaba

Csaba
Wed Jul 20 15:07:25 CDT 2005

Antknee wrote:
> Hi. I have two text files that are actually exports of user and computers
> accounts from two domains. I would like to be able to compare the two files
> for duplicate names and spit out a "report" of the unique names and duplicate
> names.

Perhaps one of the suggested file comparison programs will work for
you. However, if the name order between files is not well correlated
(e.g. alphabetized), your file comparison program(s) may become
confused.

Another possible approach is to use a dictionary and parse each file
one line at a time. Specifically, create an empty dictionary (Set
dct=CreateObject("Scripting.Dictionary")) and for each line in the
first file, add it as a key/value pair to the dictionary (dct.Add key,
itemValue -you haven't said exactly what you are comparing).

Now you will parse the second file. For each line check to see whether
it's in the dictionary (dct.Exists(item)). If so, then it is a name
common to both files (and now either delete it or mark it as seen,
somehow). If not, it is a name unique to the 2nd file. Finally,
iterate through the dictionary (For each item in dct) and every
remaining entry is a name unique to the first file.

This code is compact, efficient, and local.
There is a Jun 20, 2005 example titled
Compare the values of two sorted arrays of variable size
at
http://groups-beta.google.com/group/microsoft.public.scripting.vbscript/browse_frm/thread/79770dda5c1b0bcb/d7a31ba39698a3ba
Good luck,
Csaba Gabor from Vienna