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

RE: [NTS] output file of lines matching search string

Expand Messages
  • dj Rick Mitchell
    Yes, such a script exists. It is below. I use it all the time. As you can see in the script thee is a link to the place on the net where this script calls
    Message 1 of 3 , Oct 19, 2010
    • 0 Attachment
      Yes, such a script exists. It is below. I use it all the time. As you can
      see in the script thee is a link to the place on the net where this script
      calls home.
      He also has a script that will DELETE LINES that match a certain criteria
      and another to create a table structure.

      Hope that helps.

      RICK



      FIND LINES
      ^!Continue Find Lines v1.0^%NL%a NoteTab clip by Joe Barta -
      HTMLisEasy.com^%NL%^%NL%This clip will scan your document looking for your
      search phrase. If any lines containing your search phrase are found, they
      are copied to a new document. Choose between a case-sensitive or
      case-insensitive search, and chose whether you'd like your search results to
      include line numbers.^%NL%^%NL%Note - It's meant to search for text line by
      line, so searching for chunks of text that contain line breaks will probably
      give unpredictable results. Also, there is no support in this clip for
      regular expressions... yet.^%NL%^%NL%Click OK to proceed.

      ;
      ============================================================================
      =
      ; Find Lines v1.0
      ; a NoteTab clip by Joe Barta - HTMLisEasy.com
      ; http://www.htmliseasy.com/notetab/findlines.html
      ;
      ; Scans document for lines containing a search term,
      ; then builds a new document containing those lines.
      ; Full details and instructions at the web site above.
      ;
      ============================================================================
      =


      ;kill all variables hanging around in memory
      ^!ClearVariables

      ^!Set %searchstring%=^?[Search for]
      ^!Set %case%=^?[(H=2)Case==_case-insensitive^=0|case-sensitive^=1]
      ^!Set %linenumbers%=^?[(H=2)Include line numbers?==_yes|no]

      ^!IF ^$StrSize(^%searchstring%)$ > 0 SKIP_2
      ^!Prompt No search term entered. Aborting clip.
      ^!Goto EXIT

      ^!SetWordWrap OFF

      ;is there a carriage return at the end of the doc?
      ^!Jump TEXT_END
      ^!If ^$GetCol$ = 1 SKIP_2
      ^!Continue I have to insert a carriage return at the end of your document in
      order to process this clip. You can remove it later if you wish. Press OK to
      continue.
      ^!InsertText ^%NL%

      ^!SetCursor 1:1

      ^!Set %foundlines%=0
      ^!Set %docpos1%=^$GetDocIndex$
      ^!Toolbar New Document
      ^!Set %docpos2%=^$GetDocIndex$
      ^!SetDocIndex ^%docpos1%

      ^!SetCursor 1:1
      ^!Set %currentline%=1

      :FINDLOOP

      ^!If ^%case% = 1 SKIP
      ^!Find ^%searchstring% TIS
      ^!If ^%case% = 0 SKIP
      ^!Find ^%searchstring% TS

      ^!IF ^$GetSelSize$ = 0 FINISH
      ^!Select LINE

      ^!If ^%linenumbers% = no SKIP
      ^!SetClipboard Line ^$GetRow$:^%TAB%^$GetSelection$
      ^!If ^%linenumbers% = yes SKIP
      ^!SetClipboard ^$GetSelection$

      ^!Set %currentline%=^$Calc(^$GetRow$+1)$
      ^!SetDocIndex ^%docpos2%
      ^!Paste
      ^!Set %foundlines%=^$Calc(^%foundlines%+1)$
      ^!SetDocIndex ^%docpos1%
      ^!SetCursor ^%currentline%:1
      ^!Goto FINDLOOP
      :FINISH


      ^!SetDocIndex ^%docpos2%
      ^!SetCursor 1:1
      ^!IF ^$GetTextSize$=0 NOMATCH_MESSAGE ELSE TITLE_LINE
      ^!Goto TITLE_LINE

      :NOMATCH_MESSAGE
      ^!DestroyDoc
      ^!SetDocIndex ^%docpos1%
      ^!Prompt No lines match ^%searchstring%
      ^!Goto EXIT


      :TITLE_LINE
      ^!IF ^%foundlines%=1 LINE ELSE LINES
      :LINE
      ^!Set %line%=line
      ^!Goto DONE_LINES
      :LINES
      ^!Set %line%=lines
      ^!Goto DONE_LINES
      :DONE_LINES


      ^!SetCursor 1:1
      ^!InsertText Found ^%foundlines% ^%line% containing ^%searchstring%^%NL%
      ^!InsertText =======================================================^%NL%
      ^!SetCursor 1:1
      ^!Goto EXIT


      :EXIT


      _____

      From: ntb-scripts@yahoogroups.com [mailto:ntb-scripts@yahoogroups.com] On
      Behalf Of rolfessenden
      Sent: Monday, October 18, 2010 10:03 PM
      To: ntb-scripts@yahoogroups.com
      Subject: [NTS] output file of lines matching search string




      Hi,

      I am deciding to buy this (or not). One key task is to create an output file
      of the lines containing the search string.

      It looks like this is easy to do. Can anyone confirm that or not? Do such
      scripts already exist?

      Any help greatly appreciated.

      Rol






      [Non-text portions of this message have been removed]
    • Eb
      I m not the moderator, nor do I object to you posting this question here, but you ll have a better chance for getting a helpful answer in other NoteTab groups.
      Message 2 of 3 , Oct 20, 2010
      • 0 Attachment
        I'm not the moderator, nor do I object to you posting this question here, but you'll have a better chance for getting a helpful answer in other NoteTab groups. The "notetab" group discusses general usage of NoteTab, the "ntb-clips" group discusses INTERNAL scripts and macros, called "clips" in NoteTab.

        This group supposedly discusses EXTERNAL scripts, in Perl, VB, JS, etc, and accessed by NoteTab as external programs.


        In the "ntb-clips" there are a bunch of regular expression experts who can tell you how to do this in a one-line clip, or even how to do this from NoteTab's menu.

        If you have experience in regular expressions, look in the help menu for "Help on Clip Programming", and search the help INDEX for the ^$GetDocMatchAll function. Properly primed, that function will collect what you want into an array, which you can then paste to another document.


        Cheers,


        Eb

        --- In ntb-scripts@yahoogroups.com, "rolfessenden" <rol@...> wrote:
        >
        > Hi,
        >
        > I am deciding to buy this (or not). One key task is to create an output file of the lines containing the search string.
        >
        > It looks like this is easy to do. Can anyone confirm that or not? Do such scripts already exist?
        >
        > Any help greatly appreciated.
        >
        > Rol
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.