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

[Clip] Re: Sorting queries.

Expand Messages
  • Claes Gauffin
    Hi John, ... Picking the easy one. Beware though, it _is_ a clip. In a previous life I worked on Macintosh. There is a quite nice editor there called BBEdit
    Message 1 of 9 , Sep 3, 1999
    • 0 Attachment
      Hi John,

      At 00:14 1999-09-04 +1000, you wrote:

      >(2) Is it possible to search the list and show ONLY those lines that
      >have eg. "zdnet" in ? If so how ?
      >

      Picking the easy one. Beware though, it _is_ a clip.
      In a previous life I worked on Macintosh. There is a quite nice editor
      there called BBEdit (no competition Jody, another platform!:-). Most of its
      features are in NoteTab, but there is one that I missed, and therefore has
      mimicked in a clip. In BBEDit it is called "Find all". You give a search
      argument, the file is scanned, and all hits are displayed in a separate
      window, one line per hit. Double-clicking on any hit then brings you back
      to the original file, in the right position.

      The following clip tries to do this. The hits are entered into a new
      document. For each hit there is a link back to the original document. It
      also handles outlines. You may want to strip those features (links &
      outline handling).

      Expanding the clip to cover the search of lines _not_ containing an
      argument should be doable. Have to think about it. (Anyone but me find this
      clip writing slightly addictive? Is there a CA (Clipwriters Anonymous)?

      Regards /Claes


      H="Search and make hit list"
      ;_Search a (presumably large) text file and create a list with
      ;_all hits. Each hit is displayed with the line containing
      ;_the hit, plus a link.
      ;_Two alternatives are recognized:
      ;_ 1. The text file is an outline. For each hit, the corresponding topic
      ;_ is displayed, and the link is to that same topic.
      ;_ 2. All other text files. The links are to the corresponding
      ;_ line of each hit.

      ^!StatusShow Searching....
      ;^!SetScreenUpdate OFF
      ^!SetWordWrap OFF
      ^!set %string%=^?{Search string};%case%=^?{Case
      sensitive==Yes^=""|_No^=I};%regexp%=^?{Reg exp==Yes^="R"|_No^=""}
      ^!Find "^%string%" WTS^%case%^%regexp%
      ^!IfError NoHit
      ^!Set %Save%=SEARCH RESULT FOR "^%string%" IN "^##"
      ^!Append %Save%=^%NL%^$StrFill(¯;^$StrSize(^%Save%)$)$^%NL%
      :Search
      ^!IfTrue ^$IsOutlineDoc$ Outline Else Flatfile
      :Outline
      ^!Set %Data1%=Topic: ^$StrUpper(^$GetTopicName$)$^%NL%
      ^!Set %Data2%=^$StrCopyRight(000^$GetRow$;4)$^%TAB%^$GetLine$^%NL%
      ^!Set %Data3%=^%TAB%Link: [^##::^$GetTopicName$]^%NL%^%NL%
      ^!GoTo Appendit
      :Flatfile
      ^!Set %Data1%=""
      ^!Set %Data2%=^$StrCopyRight(000^$GetRow$;4)$^%TAB%^$GetLine$^%NL%
      ^!Set %Data3%=^%TAB%Link: [^##::^$GetRow$^^L]^%NL%^%NL%
      :Appendit
      ^!Append %Save%=^%Data1%^%Data2%^%Data3%
      ^!Set %r%=^$GetRow$
      ^!Jump +1
      ^!If ^%r%=^$GetRow$ Done
      ^!Find "^%string%" TS^%case%^%regexp%
      ^!IfError Done
      ^!GoTo Search
      :Done
      ^!Toolbar New Document
      ^!InsertText ^%Save%
      ^!Jump DOC_START
      ^!Jump LINE_END
      ^!Goto Exit
      :Nohit
      ^!Info "^%string%" not found anywhere in the file
    • Claes Gauffin
      Hi John, ... Hmmm, busy afternoon:-) Another clip I m afraid. Regards /Claes ^!SetScreenUpdate OFF ^!set %myix%=^$GetDocIndex$ ^!Open ^?[(T=O)Import file]
      Message 2 of 9 , Sep 3, 1999
      • 0 Attachment
        Hi John,

        At 00:14 1999-09-04 +1000, you wrote:

        >
        >(6) Rather than open two text files, and then "cut and paste" the
        >second one to insert it at the end of the first one, is there any
        >quicker way to "open" (import ?) the contents of a second text file
        >directly to the end of an already open first file ?
        >

        Hmmm, busy afternoon:-)
        Another clip I'm afraid.

        Regards /Claes

        ^!SetScreenUpdate OFF
        ^!set %myix%=^$GetDocIndex$
        ^!Open ^?[(T=O)Import file]
        ^!Select ALL
        ^!Set %content%=^$GetSelection$
        ^!Close
        ^!SetDocIndex ^%myix%
        ^!Jump DOC_END
        ^!InsertText ^%content%
      • Lawrence M Hamilton, Jr.
        Claes, On Fri, 03 Sep 1999 16:55:22 +0200 Claes Gauffin ... (Clipwriters ... Jody & I are charter members! ;) Larry Hamilton, Jr.
        Message 3 of 9 , Sep 3, 1999
        • 0 Attachment
          Claes,

          On Fri, 03 Sep 1999 16:55:22 +0200 Claes Gauffin <gauffin@...>
          writes:
          > (Anyone but me find this clip writing slightly addictive? Is there a CA
          (Clipwriters
          > Anonymous)?
          >
          > Regards /Claes

          Jody & I are charter members! ;)


          Larry Hamilton, Jr. lmhamilton@...
          Hamilton National Genealogical Society, Inc.
          http://www.HamiltonGenSociety.org/
          My Web Site: http://members.tripod.com/notlimaH/

          ___________________________________________________________________
          Get the Internet just the way you want it.
          Free software, free e-mail, and free Internet access for a month!
          Try Juno Web: http://dl.www.juno.com/dynoget/tagj.
        • Wayne VanWeerthuizen
          ... Most of your requests require clips. But I ve written a toolkit called NoteAwk, just for situations like this. You shouldn t have to do much clip
          Message 4 of 9 , Sep 3, 1999
          • 0 Attachment
            John Fitzsimons <johnf@...> wrote:

            >I am hoping that I can do the following WITHOUT using any clips BUT as
            >they might be needed I thought I would ask on this list.

            Most of your requests require clips. But I've written a toolkit
            called NoteAwk, just for situations like this. You shouldn't
            have to do much clip programming yourself.


            NoteAwk 4.25 is available from:
            http://landru.myhome.net/wayne/notetab.html

            >(1) In the following "list" of URLs I can "sort" on the first word of
            >each line. Is it possible to sort on the last word of each line ? If
            >so then what are the steps please ?

            In my NoteAwk clipbook: Sort Using GNU Sort

            >(2) Is it possible to search the list and show ONLY those lines that
            >have eg. "zdnet" in ? If so how ?

            In my NoteAwk clipbook: Find Line Matching Pattern

            >(3) Is it possible to show all lines EXCEPT those that contain
            >"zdnet" ? If so how ?

            In my NoteAwk clipbook: Find Line Matching Pattern
            Show non-matching lines

            >(4) Is there any way to block delete everything on every line EXCEPT
            >the file name ? If so how ?

            Possibly with NoteAwk. Either the "Remove fields matching pattern",
            or the "Rearrange fields" clips may help. This may take some
            strategic search and replaces to prepare the text first.

            >(5) To see the end of these lines one has to scroll. Is there any way
            >to "view" a NoteTab document a different size ? Like eg. Word,
            >WordPerfect etc. where one can shrink a page to eg. 50% to see
            >twice as wide a page ?

            NoteTab lets you add Font Size buttons to your toolbar.

            >(6) Rather than open two text files, and then "cut and paste" the
            >second one to insert it at the end of the first one, is there any
            >quicker way to "open" (import ?) the contents of a second text file
            >directly to the end of an already open first file ?

            First, look for "Insert File" in the Document menu.

            Also, the clip language has the command:
            ^!InsertFile FileName


            NoteAwk 4.25 is available from:
            http://landru.myhome.net/wayne/notetab.html

            There are some rough spots in it. Email me any questions
            you have about how to use it. If people would start sending
            me more feedback on where they have difficulty with it -
            what works well - and what features should be added, I may
            get back to work on an improved version. But I need
            feedback.




            --
            Wayne M. VanWeerthuizen
            ICQ: 15117288
            Homepage: http://landru.myhome.net/wayne
          • Kay Roath
            09/03/1999 7:14 AM John Fitzsimons wrote ... Those of us who have read every post can t remember all the questions that have been answered :) ... Here are the
            Message 5 of 9 , Sep 3, 1999
            • 0 Attachment
              09/03/1999 7:14 AM John Fitzsimons wrote

              > I estimate that I am about 50 years behind in reading
              > these posts so my apologies if any of these questions have
              > been answered recently.

              Those of us who have read every post can't remember all the
              questions that have been answered :)

              > I am hoping that I can do the following WITHOUT using any
              > clips BUT as they might be needed I thought I would ask on
              > this list.

              Here are the ones you can do without using clips.

              > (5) To see the end of these lines one has to scroll. Is
              > there any way > to "view" a NoteTab document a different
              > size ? Like eg. Word, > WordPerfect etc. where one can
              > shrink a page to eg. 50% to see > twice as wide a page ?

              No. The best you can do is use Document Menu|Font then
              Change Font or Decrease Font to get it as small as you can
              with the fonts you have. If you go with Decrease Font, it's
              easier to use a clip than work your way through the menu.
              ^!ToolBar Decrease Font Size
              or put it on your ToolBar or Shortcut menu using those tabs
              in Options.

              > (6) Rather than open two text files, and then "cut and
              > paste" the second one to insert it at the end of the first
              > one, is there any quicker way to "open" (import ?) the
              > contents of a second text file directly to the end of an
              > already open first file ?

              Document Menu|Insert File

              --- Grandma Kay ---
            • Kay Roath
              09/03/1999 7:14 AM John Fitzsimons wrote ... Does last word mean file name? If not, you could change / to . in the clip below. ... H=Sort urls by File ;
              Message 6 of 9 , Sep 3, 1999
              • 0 Attachment
                09/03/1999 7:14 AM John Fitzsimons wrote
                > (1) In the following "list" of URLs I can "sort" on the
                > first word of each line. Is it possible to sort on the
                > last word of each line ? If so then what are the steps
                > please ?

                Does last word mean file name? If not, you could change '/'
                to '.' in the clip below.

                ----Start Clip----
                H=Sort urls by File
                ; Grandma Kay 09-03-99
                ; sort urls by text following last /
                ; use on copy of original doc
                ^!SetWordWrap False
                ^!Set %list%=
                ^!Set %num%=1

                :Loop
                ^!Jump ^%num%
                ^!KeyBoard Shift+End
                ^!Set %temp%=^$GetSelection$
                ^!Set %chop%=^$StrPosRight("/";"^%temp%";No)$
                ^!Inc %chop%
                ^!Set %end%=^$StrSize("^%temp%")$
                ^!Set %name%=^$StrCopy("^%temp%";^%chop%;^%end%)$
                ^!KeyBoard Home #^%name% #

                ^!Inc %num%
                ^!If ^%num% > ^$GetLineCount$ Sort ELSE Loop

                :Sort
                ^!StatusClose
                ^!ToolBar Select All
                ^!ToolBar Sort Ascending
                ;---End Clip---
              • Claes Gauffin
                Hi John, ... I think the following clip does it. The speed of it can kindly be called modest, possibly dignified. Unless you have cows to milk or houses to
                Message 7 of 9 , Sep 6, 1999
                • 0 Attachment
                  Hi John,

                  At 00:14 1999-09-04 +1000, you wrote:

                  >
                  >(2) Is it possible to search the list and show ONLY those lines that
                  >have eg. "zdnet" in ? If so how ?
                  >
                  >(3) Is it possible to show all lines EXCEPT those that contain
                  >"zdnet" ? If so how ?

                  I think the following clip does it.
                  The speed of it can kindly be called modest, possibly dignified.
                  Unless you have cows to milk or houses to paint during the wait, I wouldn't
                  apply it to files with 10000+ lines.

                  Regards /Claes

                  H="Extended search"
                  ^!SetWordWrap OFF
                  ^!Jump TEXT_START
                  ^!set %string%=^?[Search string]
                  ^!set %case%=^?[Case sensitive==Yes^=""|_No^=I]
                  ^!set %regexp%=^?[Reg exp==Yes^="R"|_No^=""]
                  ^!set %lno%=^?[Add linenumbers?==_Yes|No]
                  ^!set %pn%=^?[Collect lines...==_containing the search argument^=p|not
                  containing the search argument^=n]
                  ^!set %save%=""
                  ^!If ^%pn%=n SearchNotArg
                  :SearchArg
                  ^!Find "^%string%" TS^%case%^%regexp%
                  ^!IfError Done
                  ^!set %linecont%= ^$GetLine$
                  ^!set %n%=^$[^$StrSize(000^$GetRow$)$-3;0]
                  ^!Set rownr=^$StrCopy("000^$GetRow$";^%n%;4)$
                  ^!If ^%lno% = Yes Skip
                  ^!Set rownr=""
                  ^!Append %save%=^%rownr%^%linecont%^%NL%
                  ^!If ^$GetRow$=^$GetLineCount$ Done
                  ^!Jump +1
                  ^!GoTo SearchArg
                  :SearchNotArg
                  ^!Select LINE
                  ^!Find "^%string%" HTS^%case%^%regexp%
                  ^!IfError NotThere
                  ^!If ^$GetRow$=^$GetLineCount$ Done
                  ^!Jump +1
                  ^!Goto SearchNotArg
                  :NotThere
                  ^!set %linecont%= ^$GetLine$
                  ^!set %n%=^$[^$StrSize(000^$GetRow$)$-3;0]
                  ^!Set rownr=^$StrCopy("000^$GetRow$";^%n%;4)$
                  ^!If ^%lno% = Yes Skip
                  ^!Set rownr=""
                  ^!Append %save%=^%rownr%^%linecont%^%NL%
                  ^!If ^$GetRow$=^$GetLineCount$ Done
                  ^!Jump LINE_START
                  ^!Jump +1
                  ^!GoTo SearchNotArg
                  :Done
                  ^!Toolbar New Document
                  ^!InsertText ^%save%
                • Claes Gauffin
                  Hi Kay, John, ... Perhaps a little cleaning up at the end? Regards /Claes ; Grandma Kay 09-03-99 ; sort urls by text following last / ; use on copy of
                  Message 8 of 9 , Sep 6, 1999
                  • 0 Attachment
                    Hi Kay, John,

                    At 13:35 1999-09-03 -0700, you wrote:

                    >
                    >----Start Clip----
                    >H=Sort urls by File
                    >; Grandma Kay 09-03-99
                    >; sort urls by text following last /
                    >; use on copy of original doc

                    Perhaps a little cleaning up at the end?

                    Regards /Claes

                    ; Grandma Kay 09-03-99
                    ; sort urls by text following last /
                    ; use on copy of original doc
                    ^!SetWordWrap False
                    ^!Set %list%=
                    ^!Set %num%=1

                    :Loop
                    ^!Jump ^%num%
                    ^!KeyBoard Shift+End
                    ^!Set %temp%=^$GetSelection$
                    ^!Set %chop%=^$StrPosRight("/";"^%temp%";No)$
                    ^!Inc %chop%
                    ^!Set %end%=^$StrSize("^%temp%")$
                    ^!Set %name%=^$StrCopy("^%temp%";^%chop%;^%end%)$
                    ^!KeyBoard Home #^%name% xyzzy#

                    ^!Inc %num%
                    ^!If ^%num% > ^$GetLineCount$ Sort ELSE Loop

                    :Sort
                    ^!StatusClose
                    ^!ToolBar Select All
                    ^!ToolBar Sort Ascending

                    ^!Jump DOC_START
                    :CleanUp
                    ^!Replace ".* xyzzy" >> "" TSR
                    ^!IfError Exit
                    ^!GoTo CleanUp
                  Your message has been successfully submitted and would be delivered to recipients shortly.