Solved

compare two text files - script  please

Posted on 2014-02-10
5
442 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
Comment Utility
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
Comment Utility
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 51

Accepted Solution

by:
Bill Prew earned 250 total points
Comment Utility
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 51

Expert Comment

by:Bill Prew
Comment Utility
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
Comment Utility
thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now