Page 1 of 1

Search for multiple lines of text within another file

Posted: Wed Jun 24, 2009 2:58 pm
by stooley
Hi all
I hope this is just a simple one to answer.
I've spent some time searching but havent found this question or answer.
I have:

1000222344
100045566
1000666778

and so on in a txt file (apprx 5000 lines) and would like to search for their occurance in another file csv for example

34666,122,1000222344,yes,no,go
34667,122,100045566,no,yes,stop

I cant do anything within Wild edit as the files are greater than 10kb. I cant do a search in 'Find In files' as I would like to search for everything. Any help is appreciated.

Thanks

Posted: Wed Jun 24, 2009 9:34 pm
by Bob Hansen
You might be able to record a macro to handle this.

You need to open both files in TextPad:
File1 = Search List and File2 = File to be searched

Then create a macro to do this:
1. Go to top of File1.
2. Copy value into clipboard.
3. Delete that first line
4. Switch to File2 and do search using value copied from File1
5. Switch back to File1.

Run macro as many times as needed until no lines left in File1.

Posted: Wed Jun 24, 2009 9:52 pm
by Bob Hansen
Just had another thought.

You could open File1, and replace "\n" with "|"
Save that whole file string within "(.....)".
Copy that whole string to the clipboard and paste it as a Search expression and use RegEx

Find what: (1000222344|100045566|1000666778|.............. )

Find Next to locate the next instance of any of the strings.

Use the following settings:
-----------------------------------------
[X] Regular expression
-----------------------------------------

Posted: Thu Jun 25, 2009 9:58 am
by stooley
Thanks bob.

The second of your suggestion works apart from the fact that I can only copy and paste the contents of apprx 700 references whereas within File1 there are apprx 5000.

Is uppose I can split the file up into blocks of 500 or so to do this.

Thanks again