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

Re: R.H.S. sorting - possible ?

Expand Messages
  • John Zeman
    ... You can do this in NoteTab without using a script. That s the good news. The bad news is it would be far simpler to use a script to do it. However you
    Message 1 of 5 , Aug 10, 2004
    • 0 Attachment
      --- In notetab@yahoogroups.com, John Fitzsimons <johnf@n...> wrote:
      >
      > Hi,
      >
      > I want to sort lines in a text file from the end. Is that possible ?
      >
      > I start with ;
      >
      > 9/Aug/04 02:47: /~johnf/web15.jpg
      > 9/Aug/04 02:02: /~johnf/knight.gif
      > 9/Aug/04 01:40: /~johnf/spirits.htm
      > 9/Aug/04 02:02: /~johnf/welcome.htm
      > 9/Aug/04 02:47: /~johnf/chspirit.htm
      > 9/Aug/04 02:20: /~johnf/ouija.htm
      > 9/Aug/04 02:02: /~johnf/world2.jpg
      > 9/Aug/04 02:02: /~johnf/blue.jpg
      >
      > Suppose I want to sort things so that all the .gifs, htm etc. files
      > are together ? Or perhaps together and sorted in each category eg.
      >
      > ...................1.gif
      > ...................2.gif
      > ...................3.gif
      > ...................1.htm
      > ...................2.htm
      >
      > etc. etc.
      >
      > How would I do this ? Sorting from the end of a line rather than the
      > beginning ? Or does someone know of another program to do this ?
      >
      > My preference is not to use a script if at all possible.
      >
      > Regards, John.



      You can do this in NoteTab without using a script. That's the good
      news. The bad news is it would be far simpler to use a script to do
      it. However you asked for a non script way to sort by the ends of
      lines, based on your example below, here is a way can do this using
      NoteTab's find/replace tool and regular expressions.

      9/Aug/04 02:47: /~johnf/web15.jpg
      9/Aug/04 02:02: /~johnf/knight.gif
      9/Aug/04 01:40: /~johnf/spirits.htm
      9/Aug/04 02:02: /~johnf/welcome.htm
      9/Aug/04 02:47: /~johnf/chspirit.htm
      9/Aug/04 02:20: /~johnf/ouija.htm
      9/Aug/04 02:02: /~johnf/world2.jpg
      9/Aug/04 02:02: /~johnf/blue.jpg

      First, I'm assuming the above is the only text in the file. If it's
      not, you'll need to select the text you want sorted before doing each
      of the following steps.

      Press CTRL+R to bring up the NoteTab find/replace dialog box. Make
      sure the checkbox called REGULAR EXP. is NOT checked. Also above the
      regular expression checkbox, make sure the Search option is set to
      ALL. Then in the top box which should have the FIND WHAT label to
      the left of it, type the following:

      {.*}\.jpg

      Then click in the REPLACE WITH box below it, and type the following

      \.jpg\1

      The next step is to check the REGULAR EXPRESSION box, and then
      finally press the REPLACE ALL button. If you did everything exactly
      right, your should see the lines looking like this then:

      .jpg9/Aug/04 02:47: /~johnf/web15
      9/Aug/04 02:02: /~johnf/knight.gif
      9/Aug/04 01:40: /~johnf/spirits.htm
      9/Aug/04 02:02: /~johnf/welcome.htm
      9/Aug/04 02:47: /~johnf/chspirit.htm
      9/Aug/04 02:20: /~johnf/ouija.htm
      .jpg9/Aug/04 02:02: /~johnf/world2
      .jpg9/Aug/04 02:02: /~johnf/blue

      where the JPG lines have .jpg at the beginning of the lines instead
      of the end. Repeat the exact same steps above, but change jpg to
      gif, then later gif to htm. At that point all your lines should have
      the file extensions at the front of the lines instead of the end.
      Using NoteTab's modify/lines/sort tool, sort the lines. The last
      step is to reconstruct the lines so the file extensions are once
      again at the end.

      To do that, again press CTRL+R to bring up the find/replace dialog
      box. Once again, start this step out by unchecking the REGULAR
      EXPRESSION box then in the top box enter this:

      ^\.jpg{.*}

      and in the replace with box below it, enter this:

      \1\.jpg

      Then check the regular expression box, and press the REPLACE ALL
      button. That should move the .jpg to the ends of the lines that
      begin with .jpg. Repeat the same procedure for the .gif and .htm
      lines.

      And just like that you've sorted your lines the way you wanted with
      NoteTab without using scripts!

      Simple eh?

      (Actually, compared to doing all this a script (NoteTab clip) would
      be much simpler, but at least you can see one way it could be done
      without using a clip).

      John
    • Jody
      Hi All, !!!_Too much eMail_!!! Set your options at YahooGroups to read mail on the web - No email. Or, setup filters in your eMail program - ask how on the Off
      Message 2 of 5 , Aug 10, 2004
      • 0 Attachment
        Hi All,

        !!!_Too much eMail_!!! Set your options at YahooGroups to read
        mail on the web - No email. Or, setup filters in your eMail
        program - ask how on the Off Topic list, please!-) See footer.

        Please just take this as a reminder and where to post messages.
        (Below) Truly, it all works better like this. :) Also, another
        reminder, please remove text in your replies that is not needed
        to understand your replies. This is not meant to flame anybody,
        apologies already accepted. <g>

        > It can be done with a Clip or if the file is not too big *a
        > Regular Expression*. **In either case**, please *post over* on
        > the *Clips list*. See the footer in any NoteTab Basic list
        > message to get to Yahoogroups to sign up for it or please see
        > my signature line to subscribe to it. TIA.
        > http://www.fookes.us/maillist.htm

        Please read above with my additional *highlights* and the second
        and fourth paragraphs below (which now has *more* *_highlights_*
        and I added the ----- Discussion ... ----- line at the end also
        for those that archive the messages and need an easy way to strip
        the extra code that is not wanted in the archives. Thanks! :)

        ---------- Discussion mailing lists at YahooGroups -------------

        You may sign up for the different discussion mailing lists from
        either of the links below. We use yahoogroups for the lists.
        _Please_ read the following if you decide to sign up!

        If you sign up for any of the discussion lists, please *_do not_*
        post questions about NoteTab *Clips* and other scripting languages
        (such as *RegExp*, PERL, etc.) on the NoteTab Basic list. Use the
        Clips or Scripts list for them.

        More difficult tasks should be posted on the Clips or Scripts
        lists. HTML should be posted on the ntb-HTML list and off topic
        discussion takes place on the ntb-OffTopic list. The MailBag
        Assistant, Easy Thumbnails, Easy Imager, and Album Express lists
        are for discussion of those programs.

        The most important thing to remember is please leave the NoteTab
        Basic list for the *_very basic_* use of NoteTab. The other lists
        are a lot more flexible, for instance: Clips and RegExp can be
        used and are welcomed on the HTML list. Thanks!!!

        Discussion mailing list subscribing and un-subscribing:
        http://www.fookes.us/maillist.htm
        http://www.notetab.net/html/maillist.htm

        ---------- Discussion mailing lists at YahooGroups -------------

        The NoteTabbers Assistant Page
        Useful Libraries and Clips for NoteTab: http://www.notetab.net

        Fookes Software Home Page via Jody's affiliate link:
        http://www.fookes.com/regnow.html?2448&item=home ;) Thank$ for
        getting the cookie if offered; they're delicious! :)

        >> I want to sort lines in a text file from the end. Is that possible ?
        >> 9/Aug/04 02:47: /~johnf/web15.jpg
        >> 9/Aug/04 02:02: /~johnf/knight.gif
        >
        >> My preference is not to use a script if at all possible.


        Happy Tab'n,
        Jody Adair

        NoteTabbers Assistant Page Sojourners Software
        http://www.notetab.net http://www.sojourner.us/software
        http://www.fookes.us http://www.clean-funnies.com
      Your message has been successfully submitted and would be delivered to recipients shortly.