Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Searching a bunch of text files for a particular text string


  • Please log in to reply
10 replies to this topic

#1 joe2k1

joe2k1

  • Members
  • 50 posts
  • OFFLINE
  •  
  • Local time:01:30 AM

Posted 02 February 2012 - 07:34 PM

I have a project where I need to search a large amount of text files on my home PC. I recently upgraded from Windows XP to Windows 7. My research indicated this feature was available in Windows 7.

If you do a search in Windows XP, you get a bunch of fields. You can pick to search for text INSIDE the particular sub folder structure.

I have found this feature in Windows 7, but it is different. I have tried using wild cards but it does not seem to work properly.

Thanks for any advice, if you need further assistance, I could make a video to show the issue.

BC AdBot (Login to Remove)

 


#2 Animal

Animal

    Bleepin' Animinion


  • Site Admin
  • 35,539 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Where You Least Expect Me To Be
  • Local time:10:30 PM

Posted 02 February 2012 - 07:48 PM

I don't have Windows 7. So I can't comment on how effective the search feature is. But I know I would not be able to function without the tool Agent Ransack.

It's a free utility, see if it will work for your needs: http://www.softpedia.com/reviews/windows/Agent-Ransack-Review-60432.shtml

The Internet is so big, so powerful and pointless that for some people it is a complete substitute for life.
Andrew Brown (1938-1994)


A learning experience is one of those things that say, "You know that thing you just did? Don't do that." Douglas Adams (1952-2001)


"Imagination is more important than knowledge. Knowledge is limited. Imagination circles the world." Albert Einstein (1879-1955)


Follow BleepingComputer on: Facebook | Twitter | Google+

#3 joe2k1

joe2k1
  • Topic Starter

  • Members
  • 50 posts
  • OFFLINE
  •  
  • Local time:01:30 AM

Posted 02 February 2012 - 07:55 PM

Thanks so much for your reply. I would prefer not to use third party software to look at this private data.

#4 Animal

Animal

    Bleepin' Animinion


  • Site Admin
  • 35,539 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Where You Least Expect Me To Be
  • Local time:10:30 PM

Posted 02 February 2012 - 08:13 PM

As you wish. And, you're welcome.

The Internet is so big, so powerful and pointless that for some people it is a complete substitute for life.
Andrew Brown (1938-1994)


A learning experience is one of those things that say, "You know that thing you just did? Don't do that." Douglas Adams (1952-2001)


"Imagination is more important than knowledge. Knowledge is limited. Imagination circles the world." Albert Einstein (1879-1955)


Follow BleepingComputer on: Facebook | Twitter | Google+

#5 LucheLibre

LucheLibre

  • Members
  • 608 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Tennessee
  • Local time:01:30 AM

Posted 04 February 2012 - 09:50 PM

Is this what you found so far?

Navigate to the folder you want to search. In the search box, type content:{search string}


The searchbox essentially assumes a wildcard character before and after the string, and updates with each letter typed.

Edited by LucheLibre, 04 February 2012 - 09:55 PM.

If it looks like I know what I'm doing, there's a pretty good chance the only reason for that is because
I once asked someone to run chkdsk /r and a BC Advisor smacked me in the back of the head.

~ LL ~


#6 joe2k1

joe2k1
  • Topic Starter

  • Members
  • 50 posts
  • OFFLINE
  •  
  • Local time:01:30 AM

Posted 04 February 2012 - 10:30 PM

Thanks for your reply. I tried something similar to your example and it will not find the string in a simple notepad created text file. If you have a moment, can you try and see if you have the same results? Thanks again!

#7 LucheLibre

LucheLibre

  • Members
  • 608 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Tennessee
  • Local time:01:30 AM

Posted 04 February 2012 - 10:38 PM

I've tested the command and it finds text strings in the .doc and .txt files in a folder of mine.

What exactly did you type into the search box?

Edit: If your searching for a multi-word string, put double-quotes around the string. content:"word1 word2 word3"

Edited by LucheLibre, 04 February 2012 - 10:42 PM.

If it looks like I know what I'm doing, there's a pretty good chance the only reason for that is because
I once asked someone to run chkdsk /r and a BC Advisor smacked me in the back of the head.

~ LL ~


#8 joe2k1

joe2k1
  • Topic Starter

  • Members
  • 50 posts
  • OFFLINE
  •  
  • Local time:01:30 AM

Posted 04 February 2012 - 10:47 PM

I just tried to search for this content:"tds4"

The text file contains this specific text.

--- start of file---
this is a

tds2
tds2tds2tds2tds2tds4tds2tds2tds2tds2

tds3
--eof----

I must be doing something wrong. Thanks again for your prompt response!

#9 LucheLibre

LucheLibre

  • Members
  • 608 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Tennessee
  • Local time:01:30 AM

Posted 04 February 2012 - 10:48 PM

At first I thought that was bizarre and tried a few different variations, but it's turns out simply that the search only begins after a space, puncuation marks, and line breaks, not individual letters. My apologies for saying otherwise.

tds2tds2tds2tds2tds4tds2tds2tds2tds2 only returns a match for "tds2"

tds4tds2tds2tds2tds4tds2tds2tds2tds2 only returns a match for "tds4"

I'll look into this a bit more and see if there is an operator you can use to change the search scope.

Edited by LucheLibre, 04 February 2012 - 11:12 PM.

If it looks like I know what I'm doing, there's a pretty good chance the only reason for that is because
I once asked someone to run chkdsk /r and a BC Advisor smacked me in the back of the head.

~ LL ~


#10 joe2k1

joe2k1
  • Topic Starter

  • Members
  • 50 posts
  • OFFLINE
  •  
  • Local time:01:30 AM

Posted 04 February 2012 - 10:56 PM

Any luck?

#11 LucheLibre

LucheLibre

  • Members
  • 608 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Tennessee
  • Local time:01:30 AM

Posted 04 February 2012 - 11:23 PM

As far as I can tell, the GUI will not let you do what you want. You'll need to use the command line and a program called findstr

Open a prompt and type findstr /? to learn about the syntax of the command.

A quick and dirty alternative is find /N /I "string" {path to files}\* >results.txt

That command will create a new text file in that directory with the results. It does not recurse into subdirectories though.

Edited by LucheLibre, 04 February 2012 - 11:52 PM.

If it looks like I know what I'm doing, there's a pretty good chance the only reason for that is because
I once asked someone to run chkdsk /r and a BC Advisor smacked me in the back of the head.

~ LL ~





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users