Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can applescript search one file for non-matches in another file?

I'd like to know if it's possible for Applescript to do the following:


Take a text file with 600+ URLs and compare it to another text file with 100,000+ URLs and set out as a result any URL from the first small list that is NOT included in the second larger list?


If it is possible to do this, is there anyone out there willing to create such a script for a modest fee?

Posted on Oct 6, 2013 2:18 PM

Reply
46 replies

Oct 7, 2013 11:03 AM in response to cdworin

Chris,


twtwtw's Applescript works as long as the first file is a simple list of URL's as you put into Dropbox.


If the first file will have text intermingled then adding a grep to the script get the URLs out before running twtwtw's script is easy to do.


Give his script a shot and report back. I tried it on the files you put in Dropbox and it seemed to do the trick.


regards

Oct 7, 2013 11:10 AM in response to cdworin

cdworin wrote:

The diff.txt file that it produced contained all of the URLs in File1, instead of just the single one that it should have called out.

If you want to continue to play around with this, I put the test files in my dropbox, as I noted to Frank


I saw that and tested it on File1.txt (selected 1st) and File2.txt (selected 2nd), diff.txt then had one item:

http://xxx.travelnow.com/hotels/1000000/10000/4100/4054/4054_1333_b.jpg

Oct 7, 2013 11:18 AM in response to Tony T1

TWTW, Frank and Tony.


I ran TWTW's script with my abbreviated test files and it worked just fine.


I then created a smaller version of File1, but ran it against the full 800MB version of File2. It ran for awhile, but unfortunately eventually stopped with the following error message: "

error "An error of type -116 has occurred." number -116"


I'm guessing that it ran into some URL in File2 that it couldn't process. I searched that file to see if any of the photo URLs were png files, but none of them were.


Any easy fix for error 116?

Oct 7, 2013 11:45 AM in response to twtwtw

TWTW,


Your script was great. Thanks! But it still needed a bit of tweaking because I was getting an error message when I ran it against my large data file. Meanwhile, I tested Hiroto's applescript and it worked perfectly for my needs (on test files both with and without hotel names), and was pretty fast, to boot. So, I think we have our solution. Thanks so much for all your work on this. I really appreciate it.


Best,


Chris

Oct 7, 2013 11:50 AM in response to cdworin

Not all my replies seem to make it to this thread. Here goes a final one:


Hiroto's script worked just as I needed, against the full 800MB file, both with and without hotel names in the smaller file. So, I think that's my answer. Thank you so much, Hiroto, for the help!


Frank, Tony and TWTWTW, you guys were awesome and I really appreciate all the time and effort you put into this. One thing I learned from all this (besides what a great resource the Apple communities are), is how many different ways via scripting there are to tackle the same problem. A real eye-opener!


Best,


Chris

Can applescript search one file for non-matches in another file?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.