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

23798Aw: Re: [Clip] Sorting and aligning a list

Expand Messages
  • bruce.somers
    May 22, 2013
      Excellent Art. Even survives Yahoo mail!

      Gesendet: Mittwoch, 22. Mai 2013 um 02:23 Uhr
      Von: "Art Kocsis" <artkns@...>
      An: NoteTab-Clips <ntb-clips@yahoogroups.com>
      Betreff: Re: [Clip] Sorting and aligning a list


      At 5/21/2013 03:59 PM, Flo wrote:
      >I'm dealing with a list like...
      >3 Carla
      >23 Bertha
      >110 Anthony
      >2245 Dorothy
      >99 Edward
      >The job: Sort that list on the leading numbers and make each name start at the same position. That is, the result should be...
      >···3 Carla
      >··23 Bertha
      >··99 Edward
      >·110 Anthony
      >2245 Dorothy
      >Has anyone got an efficient solution for that job?

      Nothing canned but how about this:

      ^!Replace "^\h*?\K(\d+?)(?=\h\w)" >> "000000000$1" AIRSW
      ^!Replace "^\d*?\K(\d{10}(?=\h\w)" >> "$1" AIRSW
      ^!Select ALL
      ^!Toolbar "Sort Ascending"
      ^!Replace "^000000000([1-9])" >> " $1" AIRSW
      ^!Replace "^00000000([1-9])" >> " $1" AIRSW
      ^!Replace "^0000000([1-9])" >> " $1" AIRSW
      ^!Replace "^0([1-9])" >> " $1" AIRSW

      • Basically, prepend as many leading zeros as digits in your largest
      number (nine in the example for a field width of ten digits)
      • Discard all leading zeros greater than the field width
      • Sort the doc
      • Replace leading zeros with spaces

      I haven't tested it but it should work. (right!)
      I generalized it a bit to allow for leading white space.
      Reduce or add the number of leading zeros to handle your data
      The removal of the leading zeros could be put into a loop but why bother?


    • Show all 13 messages in this topic