![]() | ||
This is a NoteTab Clip. Some version of NoteTab is required for use. |
Scans document for lines containing a search term, then deletes those lines.
Grab the clip code below and do with it what you wish. You can place it within another clip library or in its own library. Name it whatever you wish.
^!Continue Delete 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 deleted (the altered file is not saved). Can choose between a case-sensitive or case-insensitive search.^%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. ; ============================================================================= ; Delete Lines v1.0 ; a NoteTab clip by Joe Barta - HTMLisEasy.com ; https://www.htmliseasy.com/notetab/deletelines.html ; ; Scans document for lines containing a search term, then deletes those lines. ; Full details and instructions at the web site above. ; ============================================================================= ;kill all variables hanging around in memory ^!ClearVariables ^!Set %searchstring%=^?[Delete lines containing] ^!Set %case%=^?[(H=2)Case==_case-insensitive^=0|case-sensitive^=1] ^!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 %totallines%=^$GetLineCount$ :FINDLOOP ^!If ^%case% = 1 SKIP ^!Find ^%searchstring% TIS ^!If ^%case% = 0 SKIP ^!Find ^%searchstring% TS ^!IF ^$GetSelSize$=0 FINISH ^!Select LINE ^!Toolbar Cut ^!Set %foundlines%=^$Calc(^%foundlines%+1)$ ^!SetCursor 1:1 ^!Goto FINDLOOP :FINISH ^!If ^%foundlines% > 0 SKIP_2 ^!Prompt Search term not found in document. ^!Goto EXIT ^!Prompt Deleted ^%foundlines% of ^%totallines% lines containing the search term: ^%searchstring%^%NL%^%NL%(Altered document has not been saved.) :EXIT
|
|
|