Solved

compare two text files - script  please

Posted on 2014-02-10
5
447 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 53

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 53

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to dynamically set the form action using jQuery.

803 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