• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using long lists in a script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using long lists in a script


  • Subject: Re: Using long lists in a script
  • From: "Mark J. Reed" <email@hidden>
  • Date: Wed, 18 Nov 2009 07:56:06 -0500

Diff, join, and comm work with lines, not words.  It's reasonable for
the word lists to be one per line, but I assumed the input to be
arbitrary text, which will require some munging (conversion to one
word/line, punctuation elimination, case normalization) before such
shell tools will be useful.

On Tuesday, November 17, 2009, Richard Rönnbäck
<email@hidden> wrote:
> There are at least three different shell tools that will do the work for
> you, assuming that you have the two different lists saved in two separate
> files with one word on each line, sorted alphabetically.
>
> Have a look at the man pages for "diff", "join", and "comm". Personally I
> would have gone for the latter, because it is simple to use and can give you
> a very clean result.
>
> You can also take a look at the free Scripting Addition "List and Records
> tool" from www.latenightsw.com which have built-in functions to give you
> what you want with one command. If you are running Snow Leopard you must
> however understand how to work around the fact that this addition is 32-bit,
> not 64.
>
> rgds
>
> // Richard
>
>
>> Från: <email@hidden>
>> Datum: Sun, 15 Nov 2009 13:31:18 -0700
>> Till: <email@hidden>
>> Ämne: Using long lists in a script
>>
>> Hello,
>>
>> I have to compare selected text against long lists of words in 25 different
>> text documents and find out which words in the selection are not in a list.
>> Each document contains about 4,000 words. Here is my basic script:
>>
>> set list1 to {"man", "dog", "automobile"}--actual list(s) will be around 4,000
>> words
>> set list2 to {}
>> set list3 to every word of (the clipboard)
>> repeat with x from 1 to count of items of list3
>> set n to item x of list3
>> if n is not in list1 and n is not in list2 then
>> set list2 to list2 & return & n
>> end if
>> end repeat
>>
>> I've searched the archives but can't find the answer to my question. What is
>> the best way to get the words from those docs into my declared list(s)? Is
>> there some way to use an external reference? A library, perhaps?
>>
>> Randy Lewis
>>  _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> AppleScript-Users mailing list      (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> sult.se
>> Archives: http://lists.apple.com/archives/applescript-users
>>
>> This email sent to email@hidden
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>

--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Using long lists in a script (From: email@hidden)
 >Re: Using long lists in a script (From: Richard Rönnbäck <email@hidden>)

  • Prev by Date: Apple Script For Opening External EML File With Apple Mail
  • Next by Date: Re: Apple Script For Opening External EML File With Apple Mail
  • Previous by thread: Re: Using long lists in a script
  • Next by thread: Re: Using long lists in a script
  • Index(es):
    • Date
    • Thread