FINDSTR question

G

Guest

Hello,

I am looking for a command I can run from my W2K Pro or XP workstations that
will allow me to essentially grep for a string on a line, output that line in
it's entirety to the console/file, and hopefully also prefixing the filename
or something - so I can know in what files the output refers to & found the
data.

Looked so far in vain for a good grep command or GUI that will do this, but
came across FINDSTR. It seems to have most of what I need, but when I use
the /x switch I get no output.

Here is what I'm doing:
findstr /x ".*Text I'm Searching For.*" *.log

(I'm in the current directory with all the .log files I'm searching for).

Anyone a pro at this command?

Thanks,

Mike
 
K

kr

Hello,

I am looking for a command I can run from my W2K Pro or XP workstations that
will allow me to essentially grep for a string on a line, output that line in
it's entirety to the console/file, and hopefully also prefixing the filename
or something - so I can know in what files the output refers to & found the
data.

Looked so far in vain for a good grep command or GUI that will do this, but
came across FINDSTR. It seems to have most of what I need, but when I use
the /x switch I get no output.

Here is what I'm doing:
findstr /x ".*Text I'm Searching For.*" *.log

(I'm in the current directory with all the .log files I'm searching for).

Anyone a pro at this command?

Thanks,

Mike
I have had similar issues with "findstr" on xp and 2k. I *have* had more
luck reading the files in and then piping to findstr, for some reason
seems to work better..

hth
kr
 
T

Torgeir Bakken \(MVP\)

Mike said:
Hello,

I am looking for a command I can run from my W2K Pro or XP workstations that
will allow me to essentially grep for a string on a line, output that line in
it's entirety to the console/file, and hopefully also prefixing the filename
or something - so I can know in what files the output refers to & found the
data.

Looked so far in vain for a good grep command or GUI that will do this, but
came across FINDSTR. It seems to have most of what I need, but when I use
the /x switch I get no output.

Here is what I'm doing:
findstr /x ".*Text I'm Searching For.*" *.log

(I'm in the current directory with all the .log files I'm searching for).

Anyone a pro at this command?
Hi

To use regular expression, you need to use /r

As far as I see, this will give you the output you describe you
want above:

findstr /r ".*Text I'm Searching For.*" *.log
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top