Search problem
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Search problem
I am a relative newcomer to Textpad. Would like to know if there is any way to give textpad a list of words and get it to mark lines containing it in a specific file which is open.
An example should clarify what I have in mind. I have a file called wordslu.txt containing 10 words, one word to each line. I have a dictionary file called dict.txt with headwords and meanings, one to a line. I want to search the dict.txt for words in wordslu.txt and mark lines containing the words. Thanks in advance.
Mover
An example should clarify what I have in mind. I have a file called wordslu.txt containing 10 words, one word to each line. I have a dictionary file called dict.txt with headwords and meanings, one to a line. I want to search the dict.txt for words in wordslu.txt and mark lines containing the words. Thanks in advance.
Mover
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
Search problem revisited
Is it possible to run an external program on the contents of an opened file in textpad and output results to the search window or cause matches to be marked in the open file? Thanks in advance.
Mohan Chunkath
Mohan Chunkath
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
I just concocted an alternation of 500 names
from a big list. This regex is > 4000 characters long, and it works fine. I know it stops working if it gets too big, but is 500 words not enough for your purposes?
Code: Select all
name001|name002|...|name500
search problem continues....
Thanks ben for your posting...I am afraid 500 words is not enough..typically i have lists which are about 1000 words long with an average of 8 letters...add 3 characters for \|^...for each word as i want to mark only headword entries...i do run into a problem...The best workaround has been to use agrep as an external program and capture output in the command results window...does not mark the original file though..Thanks once again...
mover
mover
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
I'm not sure about that one but since you don't seem to object to external programs, what about a simple tool that takes two files (one being the words used and the other your master list), finds the intersection between the two and then outputs the regex that you can then plug into TP to bookmark all. Cheesy, very cheesy but it could get you...
Hmmmmm, that got another thought going. I was wondering what would happen if the number of matches exceeded the length of the search dialog and I was going to suggest splitting it in N partitions and running it for each partition but then I thought what about AutoIt. I really need to look at it especially since I haven't seen cyberslug post for a while. At any rate, it's a macro scheduler program that you can basically set up to open any application and execute keystrokes. So my final thought would be to write a quick script that'll compare the two files and generate the list of words found in both. Take that list and build a command script for autoit and then run autoit to open the dictionary file and bookmark all the found lines.
Doable or too much work outside of TP? The script for the comparison is in my head already especially if Sets work as beautiful in Python as I think they will.
Hmmmmm, that got another thought going. I was wondering what would happen if the number of matches exceeded the length of the search dialog and I was going to suggest splitting it in N partitions and running it for each partition but then I thought what about AutoIt. I really need to look at it especially since I haven't seen cyberslug post for a while. At any rate, it's a macro scheduler program that you can basically set up to open any application and execute keystrokes. So my final thought would be to write a quick script that'll compare the two files and generate the list of words found in both. Take that list and build a command script for autoit and then run autoit to open the dictionary file and bookmark all the found lines.
Doable or too much work outside of TP? The script for the comparison is in my head already especially if Sets work as beautiful in Python as I think they will.
I choose to fight with a sack of angry cats.
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
I did not respond to original request because I could not see a TextPad only solution, as I understood the problem. If third party tools are an acceptable option, then my first thought was to use Macro Scheduler which I use frequently with TextPad.
Could read your dictionary file, paste the words into TextPad searches, do what you want with results, and continue through all words in dictionary.
I also use AutoIt, but think you will find Macro Scheduler much easier to work with.
Could read your dictionary file, paste the words into TextPad searches, do what you want with results, and continue through all words in dictionary.
I also use AutoIt, but think you will find Macro Scheduler much easier to work with.
Hope this was helpful.............good luck,
Bob
Bob
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact: