Loading ...
Sorry, an error occurred while loading the content.
 

Re: [Clip] sorting lists with a clip

Expand Messages
  • buralex@gmail.com
    ... I think each list is of email-addresses ONLY not email-headers+bodies. I thought about changing the examples to make it clear they were supposed to be
    Message 1 of 9 , Aug 7, 2007
      "Flo" <flo.gehrke@...> said on Aug 07, 2007 8:52 -0400 (in part):
      > --- In ntb-clips@yahoogroups.com, buralex@... wrote:
      >
      >> Load list 1 into "NoName01" and list 2 into "NoName02"
      >> --- List 1 (sample) ---...
      >>
      >
      >
      Flo: Mike said in his original post:
      > I have two email lists.
      > I would like to compare the two and end of with a report of addresses which
      > are different in each list.
      I think each list is of email-addresses ONLY not email-headers+bodies. I
      thought about changing the examples to make it clear they were
      "supposed" to be email addresses but forgot to do so before sending. It
      was late ;-)

      I guess we have to wait for Mike to clarify.

      You are (I think) solving a different (and more complex) problem. For
      yours I would probably use CompareIt! (Not freeware but has a no-nags
      interface that only restricts editing in place - for that use WinMerge).
      Its also the only compare program I've seen that will actually locate
      blocks of text that have been relocated, which I believe would solve the
      problem you describe. (ie. compare two Thunderbird email folder-files
      which each contain many individual not quite identical emails.)

      I have a monthly job that involves comparing two lists (in this case of
      URLs). Up to now I've normally done it by using WinMerge to compare the
      two lists, then using its Tool-Patch option to generate a diff-list and
      a quickie clip to throwaway all but the NEW in List_A. (The others I
      don't care about.) I'll use this list at EOM to see if it works as
      quickly as I expect.

      Regards ... Alec -- buralex-gmail
      --



      [Non-text portions of this message have been removed]
    • WV-Mike
      ... Yep - you got it! I have to leave the heavy thinking up to you all. I appreciate everyone s help with this. I think I am going to try WinMerge as Alec
      Message 2 of 9 , Aug 9, 2007
        At 05:02 AM 8/7/2007 , you wrote:

        >Mike Breiding - Morgantown WV
        ><<mailto:notetab%40EpicRoadTrips.us>notetab@...> said on Aug
        >05, 2007 16:58 -0400 (in part):
        > > Not sure if this is clipable or not.
        >ANYTHING is clipable - you mean will someone do it for me :-D

        Yep - you got it!
        I have to leave the heavy thinking up to you all.

        I appreciate everyone's help with this.

        I think I am going to try WinMerge as Alec suggested and see if that does
        the trick.

        Thanks again,
        -mike



        ----------
        Check it out:
        www.EpicRoadTrips.us

        ~~~



        ~~~





        [Non-text portions of this message have been removed]
      • Don - HtmlFixIt.com
        ... Mike, you took it like a sport. I might have been offended even with the happy face in there. I think it was a fun poke in reality, but email is so hard
        Message 3 of 9 , Aug 9, 2007
          WV-Mike wrote:
          > At 05:02 AM 8/7/2007 , you wrote:
          >
          >> Mike Breiding - Morgantown WV
          >> <<mailto:notetab%40EpicRoadTrips.us>notetab@...> said on Aug
          >> 05, 2007 16:58 -0400 (in part):
          >>> Not sure if this is clipable or not.
          >> ANYTHING is clipable - you mean will someone do it for me :-D
          >
          > Yep - you got it!
          > I have to leave the heavy thinking up to you all.
          >
          > I appreciate everyone's help with this.
          >
          > I think I am going to try WinMerge as Alec suggested and see if that does
          > the trick.
          >
          > Thanks again,
          > -mike
          >
          Mike, you took it like a sport. I might have been offended even with
          the happy face in there. I think it was a fun poke in reality, but
          email is so hard to decipher in nuance sometimes.

          When one first starts clipping, it is difficult to figure out what
          direction to take sometimes. For those of us -- and I bet there are few
          of us who have not benefited from the work and contributions of another
          -- who have experience sometimes the daunting appears easy and yet I
          still ask for input regularly. I cannot tell you how many times my long
          complicated clip has been boiled down to three lines with collective
          reason. REGEX still confuses me and yet I now use it thanks to list
          members "do[ing] it for me" and then explaining (more than once) what
          they just did. So

          *for anyone lurking out there,*

          don't be afraid to ask for someone to do it for you or make
          suggestions and explain later what they did. Take the time to then
          understand even a little how they did it if you can and begin the fun
          process of learning clips.

          So my question of the day that relates, as it is string sorting ...

          From help:
          "^$StrSort("Str";CaseSensitive;Ascending;RemoveDuplicates)$ (added in v4.52)
          Returns the specified text "Str" sorted according to the defined
          criteria. NoteTab 5 supports two new values for the CaseSensitive
          parameter: ANSI to enforce a case sensitive dictionary-type sorting
          order and False_ANSI to ignore character case during sorting. The ANSI
          option produces a sorting order that matches the result from the
          Modify/Lines/Sort menu command. Note, however, that sorting is much
          slower with the ANSI option.
          For example, the following instruction will sort the lines contained in
          the Clipboard, in ascending order, ignoring character case, and removing
          duplicates:
          ^$StrSort("^$GetClipboard$";False;True;True)$"

          Jody (what a great notetab man) would often use variables in those
          true/false slots. He might ask yes/no, so it appears in addition to
          true/false you can also use yes/no. Others use 1/0 for those switches.
          I was not aware of yes/no (or had forgotten) until looking at
          noteblock library yesterday.

          I find nothing in help that describes the possible true/false
          indicators. Are there others? Are there compatibility issues with any
          of the three I mentioned here? Do they all actually work in current
          notetab?

          There is my question for the day ... and yes I want someone else to
          answer it ... :-D

          Thank you all,

          Don
        • Flo
          Alec, Thanks for that hints! If we are dealing with two lists of e-mail addresses only I would propose the following clip that combines some elements of our
          Message 4 of 9 , Aug 9, 2007
            Alec,

            Thanks for that hints! If we are dealing with two lists of e-mail
            addresses only I would propose the following clip that combines some
            elements of our two clips. It works with any kind of data in a list
            format as well (like word lists for example). I've tested it with
            15,000 entries. The job is done within a second and without any
            fault -- so far ;-)

            When tested with...

            list1.txt

            anthony@...
            bertha@...
            carla@...

            list2.txt

            bertha@...
            carla@...
            donald@...

            ...the output will be:

            Contained in list1.txt but not in list2.txt
            anthony@...

            Contained in list2.txt but not in list1.txt
            donald@...

            Regards
            Flo

            (Watch line breaks!)

            H=Comparing two lists
            ^!Set %File1%=^?{(T=O;F="Textfiles (*.txt)|*.txt")Choose first
            file:==^%File1%}; %File2%=^?{(T=O;F="Textfiles (*.txt)|*.txt")Choose
            second file:==^%File2%}
            ^!SetScreenUpdate Off
            ^!Toolbar New Document
            ^!InsertText ^$GetFileText("^%File1%")$
            ; Mark all addresses from File1 with a trailing #1
            ^!Replace "(.)$" >> "$1#1" AWRS
            ^!Jump Doc_End
            ^!InsertText ^P^$GetFileText("^%File2%")$
            ; Remove empty lines at any position
            ^!Replace "\r\n(?=\r\n)|\A\r\n|\r\n\z" >> "" AWRS
            ^!Select All
            ^$StrSort("^$GetSelection$";0;1;0)$
            ; Reduce two or more duplicates to one
            ^!Replace "(^[^\r\n]+\r\n)(\1)+" >> "$1" AWRS
            ; Remove addresses existing in both files
            ^!Replace "^([^\r\n]+)\r\n\1#1(\r\n|\z)" >> "" AWRS
            ; Select addresses that exist in File1 only
            ^!SetListDelimiter ^%NL%
            ^!Set %List1%=^$GetDocMatchAll("^[^\r\n]+#1$")$
            ; Remove adresses that exist in File1 only
            ^!Replace "^([^\r\n]+)#1(\r\n|\z)" >> "" AWRS
            ^!Jump 1
            ^!InsertText Contained in ^$GetFileName(^%File2%)$ but not in
            ^$GetFileName(^%File1%)$^P
            ^!Toolbar New Document
            ^!InsertText Contained in ^$GetFileName(^%File1%)$ but not in
            ^$GetFileName(^%File2%)$^P
            ^!InsertText ^%List1%
            ^!Replace "#1$" >> "" AWRS
          • Flo
            ... Don, I couldn t find it in the help file. But testing shows that yes/1/true and no/0/false have the same effect in NT5. By the way: I think one has to
            Message 5 of 9 , Aug 10, 2007
              --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...>
              wrote:
              > So my question of the day that relates, as it is string sorting ...

              Don,

              I couldn't find it in the help file. But testing shows
              that "yes/1/true" and "no/0/false" have the same effect in NT5.

              By the way: I think one has to thoroughly watch the effect of the
              different Case Parameters.

              For example, with...

              ^!Select All
              ^$StrSort("^$GetSelection$";0;1;0)$

              ...we get:

              cat
              dog
              doggy
              dog_1
              mouse

              With ^$StrSort("^$GetSelection$";1;1;0)$ the result is...

              cat
              dog
              dog_1
              doggy
              mouse

              Obviously, this difference has nothing to do with the case.

              Unless I'm very much mistaken, "case sensitive yes" also produces a
              (hidden) lexical sorting. That's why "dog" is followed by "dog_1" in
              the second result I suppose. So it's not only the ANSI Parameter,
              that - according with the help file - "enforce(s) a case sensitive
              dictionary-type sorting order".

              There are also differences between ^$StrSort$ and Modify| Lines |
              Sort (or Toolbar Sort Ascending). The Menu Command is controlled by
              the setting in Options | Tools I suppose. When choosing "Case
              Sensitive Sorting" (yes) in the Options, for example, the
              Menu/Toolbar Command produces...

              anthony
              Anthony
              bertha
              Bertha

              With ^$StrSort("^$GetSelection$";1;1;0)$ we get...

              Anthony
              Bertha
              anthony
              bertha

              To sum it up, I would strongly recommend to test any sorting very
              carefully before using it in a clip.

              Regards,
              Flo
            • Don - HtmlFixIt.com
              ... Flo, You and Sherri take the intelligence cake around here! Your answers are always very helpful. I noticed you used 0/1 in your example clip on sorting
              Message 6 of 9 , Aug 10, 2007
                Flo wrote:
                > --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...>
                > wrote:
                >> So my question of the day that relates, as it is string sorting ...
                >
                > Don,
                >
                > I couldn't find it in the help file. But testing shows
                > that "yes/1/true" and "no/0/false" have the same effect in NT5.
                >
                > By the way: I think one has to thoroughly watch the effect of the
                > different Case Parameters.
                >
                Flo,

                You and Sherri take the intelligence cake around here! Your answers are
                always very helpful. I noticed you used 0/1 in your example clip on
                sorting yesterday. I find the sorting things you did (and the "off"
                results of the various combinations) to be most interesting. This
                should really be documented. I am hopeful that perhaps Eric will see
                your post and give that issue some thought as it doesn't seem to me that
                we should be getting different results under each of those
                circumstances. Some of them obviously are giving different directions,
                but it appears if you give the same instruction to the menu vs strsort,
                you get differing results. Most interesting and I thank you immensely
                for your time.

                Don
              Your message has been successfully submitted and would be delivered to recipients shortly.