Page 1 of 1

selecting multiple rows from a list with another textfile

Posted: Wed Nov 24, 2010 2:50 pm
by koekie
Hi,

I have a list of thousands of rows with a specified ID. I have a second list (txt-file) with 40 ID's, but no information with them: I'd like to use this second file as a tool to extract only the rows in the first file which contain one of those 40 ID. Is this possible?

I'd prefer not to search for every row with the specified ID, as my file is very big.

Thanks in advance,

Posted: Wed Nov 24, 2010 7:26 pm
by ben_josephs
Use "Posix" regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Assuming each ID in your second file is on a line of its own, with no other text:

Copy your second file into a temporary editor document.

In the temporary document:
Search | Replace... (<F8>):
Find what: \n
Replace with: |

[X] Regular expression

Replace All
The temporary document should now contain a single line of this form:
ID1|ID2|...|IDn
Copy that line onto the clipboard,

In your first file:
Search | Find... (<F5>):
Find what: <-- paste the contents of the clipboard here

[X] Regular expression

Mark All
Copy the bookmarked lines into the paste buffer:
Edit | Copy Other | Bookmarked Lines

Open a new document and paste the bookmarked lines there.

You can't automate this in TextPad.

Posted: Thu Nov 25, 2010 8:01 am
by koekie
Thank you very much!!!