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

Re: Removing lines from a notetab list

Expand Messages
  • Sheri
    ... Hi, hey it isn t necessary to reboot in order to stop a runaway clip, just pressing Ctrl+Alt will do it. ... I duplicated your posted test lines up to
    Message 1 of 7 , Jun 19, 2006
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, "gunnisonbirder"
      <gunnisonbirder@...> wrote:
      >
      > The clip sent by Andreas worked on a 500 line file. One problem, it
      > did not stop at the end of the page? I had to use alt+ctrl+del to
      > stop the clip?

      Hi, hey it isn't necessary to reboot in order to stop a runaway clip,
      just pressing Ctrl+Alt will do it.

      > I downloaded Perl and PHP back in December when I had another
      > project. Got a book on Perl from the library, however never figured
      > out how to work it.
      >
      > I started the clip on the 43,000 line file. I don't need to watch
      > it, so it will probably do what I need for the time being.
      >
      > Thanks to both for the help. Someday, I will figure out Perl. In
      > the meantime, NoteTab Pro sure is a handy piece of software. It's
      > saving me hours of time.

      I duplicated your posted test lines up to 43000 lines and I think
      Andreas's clip only took about 6 minutes so it wasn't nearly as bad
      as I expected. However, I tried a PHP regexp on it and it did the
      same 43000 lines in less than 1 second. I duplicated the test data up
      to 430,000 lines and then it took about 5 seconds.

      Since you say you have PHP I am posting my clips. If your php.exe
      file is somewhere other than c:\php, you will need to edit the file
      location in the first clip.

      If you or anyone else wants to try it, you can copy the following two
      clips at once to the clipboard, right click over clip panel in
      Notetab (with your selected library showing) and select Add from
      clipboard. Edit the first clip for PHP file location if necessary.
      Then right click again and choose Save Now. Then load your test
      document and run the first clip. The way I did it, you would have to
      delete the top line (where I show a count of replacements - note this
      is not necessarily the number of lines deleted because anywhere there
      are multiple empty lines in a row, it only counts as one replacement).

      Regards,
      Sheri

      H="Clip to run PHP regexp"
      ^!set %starttime%=^$GetDate(tt)$
      ^!Set %linecount%=^$GetTextLineCount$
      ^!Runscript "c:\php\php.exe ^1" "PhpScript"
      ^!set %endtime%=^$GetDate(tt)$
      ^!set %info%="Start: ^%starttime%^%NL%^%endtime%"
      ^!Info Finished ^%linecount% lines!^%NL%^%NL%^%info%
      ;end of clip

      H="_PhpScript"
      <?php
      $Count = 0;
      $Pattern = "/((?m-i)^[^\r\n]*?[A-Z][^\r\n]*\r?\n)|((?m)^(\r?\n)+)/";
      $Replace = "";
      $contents = file_get_contents("php://stdin");
      //Without next line get a box char in notetab at end of file
      $contents = preg_replace( "/\r?\n?\x1A\Z/", "", $contents);
      $mytest = preg_replace( $Pattern, $Replace, $contents, -1, $Count );
      echo "PHP Result (Replacement Count is ". $Count . ")\r\n";
      echo $mytest;
      ?>
    Your message has been successfully submitted and would be delivered to recipients shortly.