PC Review


Reply
Thread Tools Rate Thread

Comparing text files

 
 
Justin Fancy
Guest
Posts: n/a
 
      23rd Oct 2006
Hi,

I have two text files and I need to compare them both, and output the
differences to another text file.

I am comparing a server directory and an IIS Log to see which server
files are of no use to the company anymore (outdated, etc.).

Any suggestions?

Justin

 
Reply With Quote
 
 
 
 
Jerold Schulman
Guest
Posts: n/a
 
      23rd Oct 2006
On 23 Oct 2006 05:04:38 -0700, "Justin Fancy" <(E-Mail Removed)> wrote:

>Hi,
>
>I have two text files and I need to compare them both, and output the
>differences to another text file.
>
>I am comparing a server directory and an IIS Log to see which server
>files are of no use to the company anymore (outdated, etc.).
>
>Any suggestions?
>
>Justin



Use the FC command.
See tip 0305 » Windows NT 4.0 has two built in File comparison commands.
in the 'Tips & Tricks' at http://www.jsifaq.com

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 
Reply With Quote
 
Alexander Suhovey
Guest
Posts: n/a
 
      23rd Oct 2006
> -----Original Message-----
> From: Justin Fancy [private.php?do=newpm&u=]
> Posted At: Monday, October 23, 2006 4:05 PM
> Posted To: microsoft.public.win2000.cmdprompt.admin
> Conversation: Comparing text files
> Subject: Comparing text files
>
>
> Hi,
>
> I have two text files and I need to compare them both, and output the
> differences to another text file.
>
> I am comparing a server directory and an IIS Log to see which server
> files are of no use to the company anymore (outdated, etc.).
>
> Any suggestions?
>
> Justin
>


Justin,

It would help if you can provide an example of your IIS logs format.

If speed is not your concern, you could probably go with something as
easy as piping dir output to find/findstr command that will take it as
an argument and will search for string occurences in you IIS logs.
Something like following (untested):

@echo off
setlocal
set iislogsdir="c:\my_iis_logs"
if exist %iislogsdir% (
for /f "delims=" %%i in (www-directory-tree.txt) do (
findstr /b /l "%%i" %iislogsdir%>nul 2>&1 || echo "%%i" is not
fould in logs.
)
)

However, depending of your www dirctory and logs sizes it could take a
long time to complete. Another caveat would be the possible presence of
certain "poison" characters in logs that findstr or batch commands could
not interpret correctly as strings and would threat them as additional.

You could also parce IIS logs first to produce a more compact summary
and then do the same against it. There's a free Microsoft tool that is
good at parsing different kind of logs including IIS called LogParser:
http://www.microsoft.com/technet/scr...ser/default.ms
px

--
Alexander Suhovey

 
Reply With Quote
 
Alexander Suhovey
Guest
Posts: n/a
 
      23rd Oct 2006
> -----Original Message-----
> From: Jerold Schulman [private.php?do=newpm&u=]
> Posted At: Monday, October 23, 2006 4:46 PM
> Posted To: microsoft.public.win2000.cmdprompt.admin
> Conversation: Comparing text files
> Subject: Re: Comparing text files
> On 23 Oct 2006 05:04:38 -0700, "Justin Fancy"
> <(E-Mail Removed)> wrote:
>
> >Hi,
> >
> >I have two text files and I need to compare them both, and output the
> >differences to another text file.
> >
> >I am comparing a server directory and an IIS Log to see which server
> >files are of no use to the company anymore (outdated, etc.).
> >
> >Any suggestions?
> >
> >Justin

>
>
> Use the FC command.
> See tip 0305 > Windows NT 4.0 has two built in File
> comparison commands.
> in the 'Tips & Tricks' at http://www.jsifaq.com
>


I'm afraid directory tree and IIS logs are so different in content that
using file-comparsion utilities would not result in an easily
interpreted output. A better definition of what OP actually need would
be IMO "How to determine if a set of text files does not contain
particular set of strings"

--
Alexander Suhovey

 
Reply With Quote
 
Alexander Suhovey
Guest
Posts: n/a
 
      23rd Oct 2006
Damned, I've sent wrong version again.

@echo off
setlocal
set logs="c:\my_iis_logs_dir"
if exist %logs% (
for /f "delims=" %%i in (www-directory-tree.txt) do (
(findstr /l "%%i" %logs%>nul 2>&1
) || (echo "%%i" not found in logs.)
)
) else (echo Cannot find %logs%)

--
Alexander Suhovey

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing 2 pipe-delimited text files sgcanning@gmail.com Microsoft Excel Discussion 1 18th May 2007 07:51 AM
Modify code using a hash table in comparing two text files richardkreidl@northwesternmutual.com Microsoft VB .NET 0 20th Aug 2005 11:41 PM
Comparing two text files Holger Kasten Microsoft C# .NET 3 22nd Jul 2005 03:21 PM
Comparing text files Peteroid Microsoft VC .NET 2 26th Apr 2005 09:19 AM
comparing text files =?Utf-8?B?cm9kY2hhcg==?= Microsoft VB .NET 6 16th Feb 2005 04:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:15 AM.