Page 1 of 1

Mark All

Posted: Thu Mar 27, 2014 1:17 pm
by gcotterl
Is there a way to do MARK ALL on the rows in a part of a text file?

For example:

My file has 1 million rows
MARK ALL finds the "FIND WHAT" string in 800,000 rows.
When I click CUT OTHER (or COPY OTHER) then click BOOKMARKED LINES, Textpad won't cut or copy all 800,000 lines.

Is there any way to select a portion of the file (say lines 1 thru 60000) then do the SEARCH and MARK ALL only within the selected range?

(I'm using TP 7.2.0 (32-bit).

Posted: Sun Mar 30, 2014 8:16 pm
by ACRobin
Any way I could see is to split the file in two (or more) and open/search that portion.

Posted: Sun Mar 30, 2014 10:12 pm
by ben_josephs
You want to mark the lines that are both in the selection and contain some string.

You can't do this directly. If you mark the lines satisfying condition A and then mark the lines satisfying condition B, you have marked the lines satisfying either condition A or condition B. There is no direct way to mark the lines satisfying both condition A and condition B.

However, logic (specifically, De Morgan's laws) tells us that
A and B = not ( not A or not B )

You can achieve not by inverting bookmarks (Search | Invert All Bookmarks).
You can mark lines not containing string S by marking lines matched by the regex
^(?!.*S)
If S contains special regex characters, use
^(?!.*\QS\E)

So you can mark all the lines in some range that contain some string like this:
1. Mark the range.
2. Invert all bookmarks (Search | Invert All Bookmarks).
3. Mark the lines not containing the string.
4. Invert all bookmarks.

This will be slow on large files.

Posted: Wed Apr 16, 2014 8:12 pm
by kengrubb
In a file of about a million records, instead of cutting 800K selected records, try:

Search, Invert All Bookmarks
Edit, Cut Other, Bookmarked Lines

That would remove the 200K records that were NOT selected and leave you with just the 800K records that were selected.