Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

compare two text files - script  please

Posted on 2014-02-10
5
Medium Priority
?
468 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 1000 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 59

Accepted Solution

by:
Bill Prew earned 1000 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 59

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] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

782 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