|
I recently found myself having a need to search ~450-500 small log files to find a specific string on my personal computer.
Shouldn't be too hard....
Windows explorer spent ~20 seconds pushing a progress bar but didn't actually look inside the files.
Textpad (my favorite editor for the last dozen years) has a mostly useless multifile search and reported it was found in 14 files but not which ones.
*rack my brain trying to remember what editors people have said good things about*
Notepad++ couldn't find a way to open that many files.
Notepad2, same 1 file limitation as the Redmond version.
Ultra edit; was taking a few seconds per file window before appearing to lock up. After ~5 minutes I killed it in disgust.
...
Remember I installed VC# express on this computer a few years ago. Start it, create a bogo project, drag the mass of log files in, Ctrl-Shift-F, 10 seconds later... VICTORY!
... but at what cost!
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Since Win 7 search is a complete failure, I resorted to installing Agent Ransack[^]
Though I often also use VS find-in-files. But then I usually have VS open anyway.
|
|
|
|
|
I recommend Agent Ransack(otherwise known as File Locator) too.
I have been using it for around 6 years and it is fast and accurate.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
I use FIND at the command line a lot; usually redirected to a file that I can then review.
Swatting a fly with a club?
modified 14-Jan-13 23:08pm.
|
|
|
|
|
The built in windows command FindStr mirrors the capabilities of the Unix command Grep.
Findstr /?
FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
[/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]]
strings [[drive:][path]filename[ ...]]
/B Matches pattern if at the beginning of a line.
/E Matches pattern if at the end of a line.
/L Uses search strings literally.
/R Uses search strings as regular expressions.
/S Searches for matching files in the current directory and all
subdirectories.
/I Specifies that the search is not to be case-sensitive.
/X Prints lines that match exactly.
/V Prints only lines that do not contain a match.
/N Prints the line number before each line that matches.
/M Prints only the filename if a file contains a match.
/O Prints character offset before each matching line.
/P Skip files with non-printable characters.
/OFF[LINE] Do not skip files with offline attribute set.
/A:attr Specifies color attribute with two hex digits. See “color /?”
/F:file Reads file list from the specified file(/ stands for console).
/C:string Uses specified string as a literal search string.
/G:file Gets search strings from the specified file(/ stands for console).
/D:dir Search a semicolon delimited list of directories
strings Text to be searched for.
[drive:][path]filename Specifies a file or files to search.
Scissors cuts paper, paper covers rock, rock crushes lizard, lizard poisons Spock, Spock smashes scissors, scissors decapitates lizard, lizard eats paper, paper disproves Spock, Spock vaporizes rock, and as it always has, rock crushes scissors.
|
|
|
|
|
Dan Neely wrote: Notepad++ couldn't find a way to open that many files.
Notepad++ can do this. You do a "find in files", set the folder to look in, set the filename pattern (e.g., "*.txt"), and indicate the search string (I think this can be a regular expression if you set that option).
|
|
|
|
|
AspDotNetDev wrote: You do a "find in files", set the folder to look in, set the filename pattern
(e.g., "*.txt"), and indicate the search string (I think this can be a regular
expression if you set that option).
I use VS 6 the same way. Always works.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I heart PowerShell.
Select-String -Pattern "MySearchText" -Path "C:\MyFolder\*.*"
This is just the simple search. It has many options.
|
|
|
|
|
Dan Neely wrote: but at what cost!
Your sanity?
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
Chris Maunder wrote: Dan Neely wrote: but at what cost!
Your sanity?
I've probably spent at least 1/3rd of the past year in the innermost circle of hell (where Java development happens); waaaaaaaaay too late to be worrying about that.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Dan Neely wrote: Textpad (my favorite editor for the last dozen years) has a mostly useless multifile search and reported it was found in 14 files but not which ones.
Then you're using it wrong.
The TextPad search produces a report of all the files that contain the string, and a right-click menu allows you to open them all in one hit.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Mark_Wallace wrote: right-click menu allows you to open them all in one hit.
Where?
Ctrl-Shift-F reports N results in the status bar. No menu appears on the find dialog. Nothing about find results appears if I right click on the edit pane. Nothing about find results appears if I right click one one of the files in the document selector. Nothing about find results appears if I right click in the search results pane (which I don't think I've ever seen actually have anything in). Nothing about find results appears if I right click on the tool output pane.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Make sure you've selected "All matching lines" in the "Report detail" group. It sounds like you've got "File counts only" selected.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
report detail group??????
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Just under the "In folder" box, roughly in the middle of the dialog:
http://postimage.org/image/yye3qzxar/[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ctrl+Shift+N is "Find Previous", the same as it is in many other applications. It won't look in multiple files (unless you have all the files open, and you have set the search dialog to search all open files, which is not what you said you needed).
Try Ctrl+F5, set your search string (using regex if you want to), enter the extensions of the file types you want to search through (*.* for all file types), choose your directories, and let it fly.
It will open a new file containing a listing of the results.
Right-click anywhere in the text of that file for the context menu.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Mark_Wallace wrote: (unless you have all the files open, and you have set the search dialog to search all open files, which is not what you said you needed).
... actually, opening all files, F5, and All Documents checked was what I was trying to use. I don't think I ever saw the Ctrl-F5 dialog before...
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Dan Neely wrote: *rack my brain trying to remember what editors people have said good things about*
WinGrep is a free tool and helped me a lot throughout the last half year (while developing an Interpreter for the Log Files of one of our instruments).
It might be too late for your sanity but maybe I save some poor souls from hell with this link[^].
|
|
|
|
|
Agent Ransack for serious file searching.
TextPad's 'find in files' (Ctrl+F5) will give you a search report with file names and line numbers. Notepad++'s equivalent gives you results in the search pane at the bottom of the screen. In neither editor do you actually have to open all the files.
|
|
|
|
|
Notepad++ has a Find in Files option.
Cygwin.
There's even a standalone grep for Windows I downloaded from somewhere and use all the time.
I love go-o-o-o-ld!
|
|
|
|
|
Agent Ransack is your best tool.
However, UltraEdit (and the rest) can do it too. If it froze it's probably fighting with another process, but eventually would have given you the results. It never fails for me.
Win7 can also do it, albeit ever so slowly. After searching for the text in the upper-right corner and maybe getting no results, you should see an option at the bottom to "Search again in:" "File Contents". All Windows versions search engines suck. Win7 sucks less by 5%.
|
|
|
|
|
Bassam Abdul-Baki wrote: Win7 sucks less by 5%.
What? I've tried every remedy I can find online and I can't make Win7 Find-in-files work reliably - even finding files themselves is flaky and error prone. I stopped using it because I can't trust it to do what I want.
WinXP search was quite slow, but easy to understand and reliable. Who at MS saw fit to break it?
|
|
|
|
|
Don't know if Win7 finds everything in files, but it did find everything I was looking for. Never compared its results to Agent Ransack, so I can't give it a guarantee.
|
|
|
|
|
It probably works well enough if you "do what you are told" by MS... i.e., put all your stuff in the "My <blah>" folders and "libraries" (whatever they are) and allow indexing and never want to look for anything but mp3s, docs, xls and pdf.
However, since I think keeping your data on your system drive is the dumbest idea ever to come from MS, I never use those folders.
|
|
|
|
|
Neither do I, and I never turn on indexing. Like I said, it's found everything that I've needed in files anywhere, including network drives, so far. However, it is extremely slow.
|
|
|
|