Udostępnij za pośrednictwem


What could be a more reliable way to find out "A word or phrase in the file"?

Well, I don't trust A word or phrase in the file search in Windows XP. And sure it needs improvement! Sometimes, it gives you results, but most of the times it doesn't :o(

Here is what you can do to prove the point which I want to make.
1. Go to your desktop and create a folder called Test
2. Create a file called Test.cs and open in Notepad.
3. Write Catch me if you can and save it.
4. Click Start -> Search.
5. Click All files and folders. Type catch in A word or phrase in the file textbox
6. Lets make its job easier by selecting Desktop in the Look In drop down.
7. Hit search and you would expect the file Test.cs come up. Right??

BUT, it won't. Atleast with my Windows XP, SP 2... it just won't. There are quite a lot of other extensions as well, which it is unable to search.

At the moment, I am just using Log Parser, so at least it tells me that there IS/ARE some files for the text which I am looking for. It doesn't tell me what is the file name, but yes, I can use it to first ensure that there are certainly those files in a folder and then manually open all files one by one in that folder (that's a pain)!

Here is how I use LOG PARSER to get it...

C:\Program Files\IIS Resources\Log Parser 2.2> LOGPARSER "Select Text from 'C:\Documents and Settings\Rahul Soni\Desktop\Test\*.*' where Text like '%catch%'" -i:TEXTLINE

And here is the output...

Text
-------------------
Catch me if you can

Statistics:
-----------
Elements processed: 85
Elements output:    1
Execution time:     0.02 seconds

So, it tells me that indeed there is a file (and I have some hope :o). As I said, the next step now is to open all the files in Notepad 1 by 1 and do CTRL + F. Another drawback is that here we are searching in folder TEST\*.*. Although that will search all the files, but if we have any folders inside TEST it won't search inside that folder :o(

I have three questions here...

1) How can we still find the files which we are looking for, RELIABLY?
2) Is there anything in Log Parser using which we can find out all the files which contain a specific Text in a folder RECURSIVELY.
3) If there is an option with Log Parser, is it possible to output FileName as well, rather than just the TextLine?

Thanks,
Rahul

Comments

  • Anonymous
    September 30, 2006
    Have a look into the findstr command. If you want to find text that will work much much easier. In your case:
    findstr /s /m catch . will display all files with catch in the text. (Specify /i for case insensitive). Also supports regex-es.
    hth, Robert

  • Anonymous
    September 30, 2006
    This blog entry is a continuation of the KB Article http://support.microsoft.com/?id=910447.
    Scenario...

  • Anonymous
    September 30, 2006
    Thanks Robert!

    It works :) It is very slow though. I tried it in a folder which contained a few pdf, zip, aspx and other files and it took almost about 4 mins to return. I believe it would be faster on the folders which have only text files and all...

    Thanks anyways, will keep this in mind :)
    Rahul

  • Anonymous
    October 03, 2006
    I am trying to select more than one row of text at time... I have tried the following: logparser -i:TEXTLINE "select text from c:qresults.txt where text like '%service_name%'and text like '%state%'" and C:batchwork>logparser -i:TEXTLINE "select text from c:qresults.txt where text like '%service_name%','%state%'" neither seem to work any suggestions?

  • Anonymous
    October 03, 2006
    What about this... logparser -i:TEXTLINE "select text from c:qresults.txt where text like '%service_name%%state%'"

  • Anonymous
    October 04, 2006
    You need to turn on 'Index files with unknown extensions' on in Windows Indexing Service if you want to search for text in files.

  • Anonymous
    October 04, 2006
    The comment has been removed

  • Anonymous
    October 04, 2006
    No problem - I went through so much pain with this one that I had to share it! I'm not sure why the facility is so hidden. Cheers .....

  • Anonymous
    October 04, 2006
    This blog entry is a continuation of the KB Article http://support.microsoft.com/?id=910447. Scenario

  • Anonymous
    December 22, 2006
    If we want to search within the subfolders also...we need to append -recurse:-1 to -i:TEXTLINE.....here -1 stands for unlimited recursion...by default this is 0 which mean no recursion

  • Anonymous
    January 06, 2007
    Hi Rahul, I've enjoyed seeing your evolving entries on Log Parser. Keep up the good work. Hey, on the subject of finding files, while the "index files with unknown extensions" is a solution, I'd be leery myself of the potential impact of that (I realize others may have no concerns on their systems). Instead, I'd like to point out that there is a useful alternative which, while it doesn't leverage the windows indexing service (an advantage since I don't run it), is still remarkably fast in finding files, whether by filename or file content. It's a free tool, whose name sounds scary, Agent Ransack, available at agentransack.com. It's a freeware version of their commercial tool, FileFinder Pro. I've pleaded with the authors to rename the free tool, as I often find it removed when I've added it to machines, as the name connotes spyware. It's nothing of the sort. Do check it out, particularly if you need to search directories other than those that you've set to be searched by the Indexing Service. It's something I use every few days. Hope that's helpful.

  • Anonymous
    January 06, 2007
    Hi Charlie, Thanks for the information and I somewhat agree about the impact. I haven't really quantified it though, and I came to know that the indexing is done when the threads are idle. BUT, I am not really sure of the timings/algorithm of the Indexing service myself. But I will try the tool out for sure :) Thanks again! Rahul

  • Anonymous
    June 15, 2009
    PingBack from http://workfromhomecareer.info/story.php?id=25026