1.

Solve : Search for a text string in a file ...?

Answer»

I would like the search a specify string in a FILE.
The case is i would like the search is any "error" wording in the a.txt file content.

I used "find /v "error" a.txt".
But it is not work. how can i do?
Many Thanks.Quote from: cityjack on August 23, 2007, 08:12:30 PM

I would like the search a specify string in a file.
The case is i would like the search is any "error" wording in the a.txt file content.

I used "find /v "error" a.txt".
But it is not work. how can i do?
Many Thanks.
pls read again the help for find. what does /v stands for. You want to get lines with "error" right?Thanks . i think in my case i should use /C in my situation.
Also, when i has 2 lines has error it show c:\a.txt: 2
And my next question is how can i capture the "2" as a parameter, because i NEED to echo this to other file.
Many thanksuse the for LOOP. set tokens, delims=: and let the for loop parse the output of the find command. then you can capture the output you want. I am sure if you do a search in this FORUM, you can find examples.


Discussion

No Comment Found