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

Re: [NTS] sort R2L, count dupes

Expand Messages
  • milan.boran@gmail.com
    ... Yes, either that, or as if read from the right. ... Just need the count of dupes per string/line/entry. ... Only the count. If there is a sorted output,
    Message 1 of 11 , Apr 7 10:39 AM
    • 0 Attachment
      > if you say right to left, do you mean sorting as if the string was reversed in each record?
      Yes, either that, or as if read from the right.

      > I'd suggest you write a script that creates a new file
      > with the records (=lines) reversed, then sort that.
      Just need the count of dupes per string/line/entry.

      > Regarding the duplicates: do you just need the count.
      Only the count. If there is a sorted output, fine, better than not.

      > or do you want to eliminate them?
      No. Notetab already would do that.

      > If you really just want the count that doesn't help for the sort exercise of course.
      Exactly :)

      Many thanks for your help,
      Milan





      On Sat, Apr 7, 2012 at 16:10, Thomas Gruber <computerhusky@...> wrote:
      >
      >
      >
      > Hi,
      > if you say right to left, do you mean sorting as if the string was reversed in each record? I'd suggest you write a script that creates a new file with the records (=lines) reversed, then sort that.
      >
      > Regarding the duplicates: do you just need the count, or do you want to eliminate them? If you want to eliminate them, you could do that first, by sorting normally, finding the duplicates, and removing them - duplicate is duplicate, whether it is reversed or not. If that reduces the record count significantly, you'd save time for the reversing exercise.
      > If you really just want the count that doesn't help for the sort exercise of course.
      > Kind regards
      > Tom
      >
      > Am 07.04.2012 um 13:03PM schrieb milanboran:
      >
      >
      >
      > > Hi NTB-Scripters!
      > >
      > > Using NoteTab, right now I try to crack a problem re a large list, ca
      > > 2mio records, stripped all other stuff away, so that only the strings
      > > that need sorting remain. But I need to sort backwards, from right to
      > > left. Then the duplicates need to be counted. Right now only the
      > > R2L-sorting and the dupe-counting remain. Any ideas? Is there a plugin
      > > for this?
      > >
      > > So far spread sheets or database programs seam not to do it per se or I
      > > simply do not know how to, yet ;) But it would be much easier, if
      > > NoteTab could do it right with the text file in it, so no export/import
      > > would be necessary.
      > >
      > > Any help is much appreciated. This is not an Easter Egg, but you can
      > > count it as an Easter Greeting :)
      > >
      > > Thank you in advance and best wishes,
      > > Milan
      > >
      > > --
      > >
      > > ----------
      > > Legal Note
      > > This message, incl. potential attachments, is of confidential or
      > > privileged nature and intended solely for individual/organization
      > > addressed. If received in error, please notify sender at once and
      > > destroy. Unintended use of message is forbidden/potentially illegal.
      > > Salvatory and severance apply, estoppel is void, e.g. in that any
      > > message or any part thereof shall be valid in their own context.
      > > ----------
      > >
      > >
      >
      > [Non-text portions of this message have been removed]
      >
      >




      --




      ----------
      Legal Note
      This message, incl. potential attachments, is of confidential or
      privileged nature and intended solely for individual/organization
      addressed. If received in error, please notify sender at once and
      destroy. Unintended use of message is forbidden/potentially illegal.
      Salvatory and severance apply, estoppel is void, e.g. in that any
      message or any part thereof shall be valid in their own context.
      ----------
    • milan.boran@gmail.com
      ... Yes, as if you would read from right to left. Basically backward sort or reverse sort (which is different from as/des-cending sort). ... Yes. Thanks for
      Message 2 of 11 , Apr 7 10:42 AM
      • 0 Attachment
        > So you want a count of how many times something appears ... I get that
        > ... but that sort order is by last character?
        Yes, as if you would read from right to left. Basically backward sort
        or reverse sort (which is different from as/des-cending sort).

        > so 2, 5, e, i, si, su
        > Is that the plan?
        Yes.

        Thanks for looking into this,
        Milan





        On Sat, Apr 7, 2012 at 18:39, Don <don@...> wrote:
        > So you want a count of how many times something appears ... I get that
        > ... but that sort order is by last character?
        >
        > so 2, 5, e, i, si, su
        >
        > Is that the plan?
        >
        > On 4/7/2012 1:26 PM, milan.boran@... wrote:
        >> Yes, good idea, Don.
        >>
        >> ### Before ###
        >> hus
        >> hus
        >> hus
        >> hus2
        >> hus2
        >> hus345
        >> hus345
        >> hus345
        >> hus345
        >> hire
        >> uni
        >> unity
        >>
        >> ### After ###
        >> hus2    2
        >> hus2    2
        >> hus345    4
        >> hus345    4
        >> hus345    4
        >> hus345    4
        >> hire    1
        >> uni    1
        >> unis    1
        >> hus    3
        >> hus    3
        >> hus    3
        >>
        >> Many thanks for looking into this,
        >> Milan
        >>
        >>
        >>
        >>
        >>
        >> On Sat, Apr 7, 2012 at 18:21, Don <don@...> wrote:
        >>>
        >>>
        >>>
        >>> While I'm sure we can figure it out with a script/clip, I'm clueless
        >>> what you are talking about.
        >>>
        >>> Maybe a small before and after sample and you will get a much bigger
        >>> response on the clips list. I'll copy there and await your example.
        >>>
        >>>
        >>>
        >>> On 4/7/2012 7:03 AM, milanboran wrote:
        >>>> Hi NTB-Scripters!
        >>>>
        >>>> Using NoteTab, right now I try to crack a problem re a large list, ca
        >>>> 2mio records, stripped all other stuff away, so that only the strings
        >>>> that need sorting remain. But I need to sort backwards, from right to
        >>>> left. Then the duplicates need to be counted. Right now only the
        >>>> R2L-sorting and the dupe-counting remain. Any ideas? Is there a plugin
        >>>> for this?
        >>>>
        >>>> So far spread sheets or database programs seam not to do it per se or I
        >>>> simply do not know how to, yet ;) But it would be much easier, if
        >>>> NoteTab could do it right with the text file in it, so no export/import
        >>>> would be necessary.
        >>>>
        >>>> Any help is much appreciated. This is not an Easter Egg, but you can
        >>>> count it as an Easter Greeting :)
        >>>>
        >>>> Thank you in advance and best wishes,
        >>>> Milan
        >>>>
        >>>>
        >>>> -
        >>>
        >>>
        >>
        >>
        >>
        >>
        >> --
        >>
        >>
        >>
        >>
        >> ----------
        >> Legal Note
        >> This message, incl. potential attachments, is of confidential or
        >> privileged nature and intended solely for individual/organization
        >> addressed. If received in error, please notify sender at once and
        >> destroy. Unintended use of message is forbidden/potentially illegal.
        >> Salvatory and severance apply, estoppel is void, e.g. in that any
        >> message or any part thereof shall be valid in their own context.
        >> ----------
        >>
        >>
        >> ------------------------------------
        >>
        >> Fookes Software: http://www.fookes.com/
        >> NoteTab website: http://www.notetab.com/
        >> NoteTab Discussion Lists: http://www.notetab.com/groups.php
        >>
        >> ***
        >> Yahoo! Groups Links
        >>
        >>
        >>
        >>
        >
        >
        > ------------------------------------
        >
        > Fookes Software: http://www.fookes.com/
        > NoteTab website: http://www.notetab.com/
        > NoteTab Discussion Lists: http://www.notetab.com/groups.php
        >
        > ***
        > Yahoo! Groups Links
        >
        >
        >



        --




        ----------
        Legal Note
        This message, incl. potential attachments, is of confidential or
        privileged nature and intended solely for individual/organization
        addressed. If received in error, please notify sender at once and
        destroy. Unintended use of message is forbidden/potentially illegal.
        Salvatory and severance apply, estoppel is void, e.g. in that any
        message or any part thereof shall be valid in their own context.
        ----------
      • jonas_ramus
        ... Running the clip below against... hus hus hus hus2 hus2 hus345 hus345 hus345 hus345 hire uni unity the result is... hus2 2 hus2 2 hus345 4 hus345 4 hus345
        Message 3 of 11 , Apr 7 3:22 PM
        • 0 Attachment
          --- In ntb-scripts@yahoogroups.com, "milan.boran@..." <milan.boran@...> wrote:
          >
          > ### Before ###
          > hus
          > hus
          > hus
          > hus2
          > hus2
          > hus345
          > hus345
          > hus345
          > hus345
          > hire
          > uni
          > unity
          >
          > ### After ###...


          Running the clip below against...

          hus
          hus
          hus
          hus2
          hus2
          hus345
          hus345
          hus345
          hus345
          hire
          uni
          unity

          the result is...

          hus2 2
          hus2 2
          hus345 4
          hus345 4
          hus345 4
          hus345 4
          hire 1
          uni 1
          hus 3
          hus 3
          hus 3
          unity 1

          I hope this is matching your needs. The clip:

          ^!Menu Edit/Copy All
          ^!Toolbar Paste New
          ^!RunGawk "gawk reverse characters"
          ^!Delay 5
          ^!Select All
          ^$StrSort("^$GetSelection$";0;1;0)$
          ^!RunGawk "gawk reverse characters"
          ^!Jump 1
          ^!SetScreenUpdate Off

          :Loop
          ^!Jump Line_End
          ^!InsertText ^%SPACE%^$StrCount("^$GetLine$";"^$GetText$";0;1)$
          ^!Jump +1
          ^!IfEmpty ^$GetLine$ End Else Loop

          where the GAWK script -- placed in a subsclip named 'gawk reverse characters' -- is...

          # Reverse characters on each line
          BEGIN { FS = "" }
          {
          for (i=NF;i>0;i--) printf("%s",$i)
          printf("\%s",RT)
          }

          The GAWK script is quite fast but the counting of occurrences could be rather slow depending on the amount of lines. Maybe someone could deliver a faster solution for that.

          Regards,
          Flo
        • milan.boran@gmail.com
          Hi Flo Doing this the 1st time, do I put this into a text file and name it somehow and load it as a clip or so into NoteTab? Please advise. ... What should I
          Message 4 of 11 , Apr 7 6:58 PM
          • 0 Attachment
            Hi Flo

            Doing this the 1st time, do I put this into a text file and name it
            somehow and load it as a clip or so into NoteTab? Please advise.

            > ^!Menu Edit/Copy All
            > ^!Toolbar Paste New
            > ^!RunGawk "gawk reverse characters"
            > ^!Delay 5
            > ^!Select All
            > ^$StrSort("^$GetSelection$";0;1;0)$
            > ^!RunGawk "gawk reverse characters"
            > ^!Jump 1
            > ^!SetScreenUpdate Off
            >
            > :Loop
            > ^!Jump Line_End
            > ^!InsertText ^%SPACE%^$StrCount("^$GetLine$";"^$GetText$";0;1)$
            > ^!Jump +1
            > ^!IfEmpty ^$GetLine$ End Else Loop
            >

            > where the GAWK script -- placed in a subsclip named 'gawk reverse characters' -- is...
            What should I do here? Save this following part as a subclip? But what
            does that mean, a subroutine, I know, but in terms of action, save it
            in a text file and then put it where?

            > # Reverse characters on each line
            > BEGIN { FS = "" }
            > {
            > for (i=NF;i>0;i--) printf("%s",$i)
            > printf("\%s",RT)
            > }

            This is great stuff. Just need to figure out the last steps.

            Many thanks for this Easter present,
            Milan





            On Sat, Apr 7, 2012 at 23:22, jonas_ramus <flo.gehrke@...> wrote:
            >
            >
            >
            > --- In ntb-scripts@yahoogroups.com, "milan.boran@..." <milan.boran@...> wrote:
            > >
            > > ### Before ###
            > > hus
            > > hus
            > > hus
            > > hus2
            > > hus2
            > > hus345
            > > hus345
            > > hus345
            > > hus345
            > > hire
            > > uni
            > > unity
            > >
            > > ### After ###...
            >
            > Running the clip below against...
            >
            >
            > hus
            > hus
            > hus
            > hus2
            > hus2
            > hus345
            > hus345
            > hus345
            > hus345
            > hire
            > uni
            > unity
            >
            > the result is...
            >
            >
            > hus2 2
            > hus2 2
            > hus345 4
            > hus345 4
            > hus345 4
            > hus345 4
            > hire 1
            > uni 1
            > hus 3
            > hus 3
            > hus 3
            > unity 1
            >
            > I hope this is matching your needs. The clip:
            >
            > ^!Menu Edit/Copy All
            > ^!Toolbar Paste New
            > ^!RunGawk "gawk reverse characters"
            > ^!Delay 5
            > ^!Select All
            > ^$StrSort("^$GetSelection$";0;1;0)$
            > ^!RunGawk "gawk reverse characters"
            > ^!Jump 1
            > ^!SetScreenUpdate Off
            >
            > :Loop
            > ^!Jump Line_End
            > ^!InsertText ^%SPACE%^$StrCount("^$GetLine$";"^$GetText$";0;1)$
            > ^!Jump +1
            > ^!IfEmpty ^$GetLine$ End Else Loop
            >
            > where the GAWK script -- placed in a subsclip named 'gawk reverse characters' -- is...
            >
            > # Reverse characters on each line
            > BEGIN { FS = "" }
            > {
            > for (i=NF;i>0;i--) printf("%s",$i)
            > printf("\%s",RT)
            > }
            >
            > The GAWK script is quite fast but the counting of occurrences could be rather slow depending on the amount of lines. Maybe someone could deliver a faster solution for that.
            >
            > Regards,
            > Flo
            >
            >




            --




            ----------
            Legal Note
            This message, incl. potential attachments, is of confidential or
            privileged nature and intended solely for individual/organization
            addressed. If received in error, please notify sender at once and
            destroy. Unintended use of message is forbidden/potentially illegal.
            Salvatory and severance apply, estoppel is void, e.g. in that any
            message or any part thereof shall be valid in their own context.
            ----------
          • flo.gehrke
            ... Milan, ... Copy the clip to clipboard, open any clipbook, and insert the clip with Add from clipboard (using the context menu inside the left pane of the
            Message 5 of 11 , Apr 7 9:45 PM
            • 0 Attachment
              --- In ntb-scripts@yahoogroups.com, "milan.boran@..." <milan.boran@...> wrote:
              >
              > Hi Flo

              Milan,

              > Doing this the 1st time, do I put this into a text file and name it
              > somehow and load it as a clip or so into NoteTab? Please advise.

              Copy the clip to clipboard, open any clipbook, and insert the clip with 'Add from clipboard' (using the context menu inside the left pane of the clipbook).

              >> where the GAWK script -- placed in a subsclip named 'gawk reverse characters'
              >> is...
              > What should I do here? Save this following part as a subclip? But what
              > does that mean, a subroutine, I know, but in terms of action, save it
              > in a text file and then put it where?

              Same procedure as above. Please note: You may name the main clip with any name whereas the subclip must be named 'gawk reverse characters' according with the subclip call.

              For more details, see the 'Help on Clip Programming' | Executing Programs | Using Perl, GAWK, and Other Scripts'.

              Regards,
              Flo
            • milan.boran@gmail.com
              Yes, this problem has been solved. Many thanks to all who helped, especially Don, Flo, Jonas, and Thomas. Best regards, Milan ... -- ... Legal Note This
              Message 6 of 11 , Apr 20 5:00 AM
              • 0 Attachment
                Yes, this problem has been solved.

                Many thanks to all who helped, especially
                Don, Flo, Jonas, and Thomas.

                Best regards,
                Milan





                On Sun, Apr 8, 2012 at 05:45, flo.gehrke <flo.gehrke@...> wrote:
                >
                >
                >
                > --- In ntb-scripts@yahoogroups.com, "milan.boran@..." <milan.boran@...> wrote:
                > >
                > > Hi Flo
                >
                > Milan,
                >
                >
                > > Doing this the 1st time, do I put this into a text file and name it
                > > somehow and load it as a clip or so into NoteTab? Please advise.
                >
                > Copy the clip to clipboard, open any clipbook, and insert the clip with 'Add from clipboard' (using the context menu inside the left pane of the clipbook).
                >
                >
                > >> where the GAWK script -- placed in a subsclip named 'gawk reverse characters'
                > >> is...
                > > What should I do here? Save this following part as a subclip? But what
                > > does that mean, a subroutine, I know, but in terms of action, save it
                > > in a text file and then put it where?
                >
                > Same procedure as above. Please note: You may name the main clip with any name whereas the subclip must be named 'gawk reverse characters' according with the subclip call.
                >
                > For more details, see the 'Help on Clip Programming' | Executing Programs | Using Perl, GAWK, and Other Scripts'.
                >
                > Regards,
                > Flo
                >
                >




                --




                ----------
                Legal Note
                This message, incl. potential attachments, is of confidential or
                privileged nature and intended solely for individual/organization
                addressed. If received in error, please notify sender at once and
                destroy. Unintended use of message is forbidden/potentially illegal.
                Salvatory and severance apply, estoppel is void, e.g. in that any
                message or any part thereof shall be valid in their own context.
                ----------
              Your message has been successfully submitted and would be delivered to recipients shortly.