Solved

compare two text files - script  please

Posted on 2014-02-10
5
450 Views
Last Modified: 2014-02-10
i have 2 list of hotfix updates from two computers.  I need to compare (working computer) against none working computer.

Is there a script or freeware program that I can use that will tell me what exist in working but doesn't exist in nonworking.  I don't want it to compare the file line for line exact i want it to search and see if it exist in one and not the other.

Thanks!
0
Comment
Question by:bbimis
  • 2
  • 2
5 Comments
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 250 total points
ID: 39847815
The following works in Linux and Unix:

Both files must be sorted, then you can use "comm":

sort working > working.sort
sort nonworking > nonworking.sort

comm -2 -3 working.sort nonworking.sort

will show all lines that are only in the first file.

Likewise

comm -1 -3 working.sort nonworking.sort

will show all lines that are only in the second file and

comm -1 -2 working.sort nonworking.sort

will show all lines that are common to both files.
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39847885
For Windows, there is e.g. "winmerge":
http://winmerge.org/

A "comm" implementation is shipped with MobaXterm:
http://mobaxterm.mobatek.net/

This tool is also an SSH/telnet/rsh client and an X-server, based on BusyBox.
It comes in a single portable exe file which works out of the box.
http://mobaxterm.mobatek.net/
0
 
LVL 54

Accepted Solution

by:
Bill Prew earned 250 total points
ID: 39847909
A great free tool for this at http://winmerge.org/

Just take the two text files you want to compare, sort them (can use the command line SORT tool) and then compare the sorted outputs.

~bp
0
 
LVL 54

Expert Comment

by:Bill Prew
ID: 39847916
I believe the solid freeware editor Notepad++ also has a "compare" mode where you can see the differences between two files.  Again, you want to do that after sorting each.

http://notepad-plus-plus.org/

~bp
0
 

Author Closing Comment

by:bbimis
ID: 39848244
thanks
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Utilizing an array to gracefully append to a list of EmailAddresses
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question