Re: Removing lines from a notetab list
- --- In email@example.com, "gunnisonbirder"
>Hi, hey it isn't necessary to reboot in order to stop a runaway clip,
> 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?
just pressing Ctrl+Alt will do it.
> I downloaded Perl and PHP back in December when I had anotherI duplicated your posted test lines up to 43000 lines and I think
> 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.
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).
H="Clip to run PHP regexp"
^!Runscript "c:\php\php.exe ^1" "PhpScript"
^!set %info%="Start: ^%starttime%^%NL%^%endtime%"
^!Info Finished ^%linecount% lines!^%NL%^%NL%^%info%
;end of clip
$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";