Solved

finstr searching multiple log files in multiple folders

Posted on 2014-03-20
5
411 Views
Last Modified: 2014-03-21
folks

how can I use the "findstr" command to search for a specific string in multiple sub folders
on a server?

the below works when looking at one file but I would like to view various log files for "bloggs"

outputting the log file name would also assist

hope anyone can assist
0
Comment
Question by:rutgermons
  • 3
  • 2
5 Comments
 
LVL 52

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 39944084
You can search all subfolders with the /S switch, so something like this:

findstr /s /i /c:"bloggs" d:\base\*.txt

~bp
0
 

Author Comment

by:rutgermons
ID: 39944093
cool

so, in essence your main folder is called "base" right?

i addition is there  a switch that checks for the string after a certain timstamp in the logs?
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 39944101
Correct on "base", all files in that folder, and all subfolders of it will be searched.

FINDSTR can use regular expressions as search strings, but no easy way to use that to start a search after a date or time in the file.

~bp
0
 

Author Comment

by:rutgermons
ID: 39944111
Ok, lastly, is there a switch to be able to look at multiple servers?

i have the same log folder setup over different servers so such a switch could assist me in troubleshooting for specific errors

cheers
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 39944130
No, but just put several lines like the example in a BAT script and change the base folder as needed for each server.

~bp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
automated changes in xml files 8 73
find replace in windows 10 9 84
Build VS2015 project in bat command 3 80
Recursively Delete Files 5 68
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now