Click here to Skip to main content
15,913,854 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have list of search phrases to be read from a config file, also I have a folder with list of subfolders and files in which i need to search all the search phrases, and prepare a flat file output, some thing like below.

Search Phrase No Of Matches in the given folder
-----------------------------------------------
Phrase1 20
Phrase2 45
.
.
.

I have one solution with .Net console application reading the phrases from config file and using findstr dos command to get the search results and write to the flat file.

Can any one provide a better solution, something like PERL script etc, which should be fast in preparing the output?
Posted
Comments
Sergey Alexandrovich Kryukov 23-May-11 11:35am    
We are not interested to write code to your order. The problem is way too trivial. Provide your code and ask your questions. What seems to be a problem?
--SA
Ramu Sangabathula Original 23-May-11 11:50am    
I am not expecting code, i need a better technology suggestion, Please let me know if the above question is not clear.

1 solution

You may be able to use regular expressions form within the console application to do this for you - I'm not sure why you'd need to use findstr. This may help[^].
 
Share this answer
 
Comments
Ramu Sangabathula Original 23-May-11 12:11pm    
I need to search the phrase in all the subfolders and files under a given folder
R. Giskard Reventlov 23-May-11 12:17pm    
You can still do that : like at DirInfo and FileInfo (http://msdn.microsoft.com/en-us/library/6yk7a1b0.aspx)
Ramu Sangabathula Original 24-May-11 7:26am    
the problem here, i have folder with 1000 of folders in it and they contain many, I don't think reading the directory in this way and using regular expressions on them is ideal, I created a 5 to 6 line solution, a batch file, which works like a charm, I have used the unix tools on windows to solve it
R. Giskard Reventlov 24-May-11 8:16am    
If the batch file 'works like a charm' what is the problem? If it ain't broke, don't fix it!
Ramu Sangabathula Original 24-May-11 10:39am    
Thanks for your help, Yesterday I was searching for a better option, by evening, i am able to figure out a batch script to do this, mean while I approached to community for better suggestions. Thanks for your valuable time. I am still testing the batch file for loads and loads of folders and files and many search phrases.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900