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

531Re: [NTS] sort R2L, count dupes

Expand Messages
  • milan.boran@gmail.com
    Apr 7, 2012
    • 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.
      ----------
    • Show all 11 messages in this topic