- At 5/22/2013 04:02 AM, you wrote:
>Art Kocsis wrote:

Yeah, I would too. But from habit and with lack of sleep for over 24 hours I didn't go that far. I also tend to be paranoid about exceptions such as leading tabs. That could be accounted for with:

>> Nothing canned but how about this:

>> Replace leading zeros with spaces

>

>I think that can be simplified:

>

>^!Replace "^(.*)$" >> " $1" WRASTI

>^!Replace "^ *?([ \d]{5}) (.+?)$" >> "$1 $2" WRASTI

>

>Then sort. I expect spaces to be sorted before all digits and thus no

>necessity to make them zeroes first.

^!Replace "^\s*?(.*)$" >> " $1" WRASTI

So a four line, non-looping clip should satisfy Flo's criteria of "efficient", yes?

Art - At 5/22/2013 06:29 AM, Flo wrote:
>--- In <mailto:ntb-clips%40yahoogroups.com>ntb-clips@yahoogroups.com, Art Kocsis <artkns@...> wrote:

I guess you are having a bad day. I don't recall you being this snarky before.

>> 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

>

>Thanks for your proposal! But let me point out some inconsistencies in your clip:

>> ^!Replace "^\h*?\K(\d+?)(?=\h\w)" >> "000000000$1" AIRSW

If you had read the rest of my post I specifically said it was to generalize in case there was any leading white space and I also said it was not tested. Furthermore, I went on to detail what the clip was supposed to do so that you would be able to correct any typos or other mistakes that I might have made. In particular, I said:

>

>What are you trying to match with '^\h*?'- in the beginning, all lines start

>with a number.

> Basically, prepend as many leading zeros as digits in your largest

Unfortunately, by including the "\K" the extraneous leading zeros were not discarded. That was a logic/coding mistake. Axel caught it. Apparently you did not.

>number (nine in the example for a field width of ten digits)

> Discard all leading zeros greater than the field width

>> ^!Replace "^\d*?\K(\d{10}(?=\h\w)" >> "$1" AIRSW

Yes, well it was supposed to have an effect and it does quite well if you remove the "\K"

>

>Syntax error - closing bracket missing after '{10}'. If corrected, it replaces 10 digits with the same 10 digits - that has no effect.

^!Replace "^\h*?(\d+?)(?=\h\w)" >> "000000000$1" AIRSW

^!Replace "^\d*?(\d{10})(?=\h\w)" >> "$1" AIRSW

The first statement (now) discards any leading white space and prepends 9 zeros to the first digit appearing on the line and ensures a minimum field width of ten digits. The existence of at least one digit is insured by the "+" in the first replace command.

The second replace command (now) matches the ten least significant digits and discards any higher order digits (which will all be zeros). The result will be a fixed width field of ten digits (some with leading zeros), followed by a space, which can then be sorted.

>> ^!Replace "^000000000([1-9])" >> " $1" AIRSW

No I haven't - at least once the incorrect "\K" is removed. The first replace effects ONLY the case for nine zeros followed by a single non-zero digit, replacing the nine zeros with nine spaces. (the nine spaces apparently got lost in the yahoo translation.) This will be the condition for an original line containing only a single digit.

>> ^!Replace "^00000000([1-9])" >> " $1" AIRSW

>> .

>Can't work - you've replaced all zeros with spaces already

The second replace command matches eight zeros followed by a non-zero digit which will be the case only when there were only two digits in the original line.

Similarly for the subsequent replace commands for the remaining leading zero cases.

>Even when making this work -- in the end, the lines will be (nearly) the same as before because there is no command that will stop removing one space after the other as soon as the clip has achieved the intended alignment.

Not sure what you are saying here as there was no command posted that removed spaces so what are you wanting to stop.

Axel's clip was essentially the same except he prepended spaces directly - obviating the need to replace leading zeros with spaces.

In subsequent posts you posted your current "solution" which would handle a maximum of FOUR digits and then proceeded to berate Axel for his not working with SIX digits. Your original posted test case had four digits max, Axel's post would handle up to five digits. It's not nice to criticize someone for not satisfying a hidden agenda.

In addition, your original post asked for an "efficient" solution. It did not ask for a general solution nor did it imply anything but a one-shot need. Please be more clear and consistent when asking for help.

At 5/22/2013 07:46 AM, Flo wrote:>Couldn't we agree on a Clip List Rule #1:

No we cannot. It takes a lot more time to thoroughly test a clip than someone may have or be willing to spend offering assistance. When it is clearly stated that they are not tested I, for one, would much rather have those ideas, suggestions and partial solutions than none at all. In my case I had other pressing matters and did not have the time to test my suggestion (as I so stated in the post). I thought it would help you and be appreciated. I was mistaken. In the future I will withhold such assistance.

>

>"Don't post anything to the List that hasn't been tested before!"