write results into a text file

Surfer Kyle picture Surfer Kyle · Dec 30, 2009 · Viewed 26.2k times · Source

I created a batch that will use windows FINDSTR to search for my selective input.

I am trying to log my results of my search term in a text file called results.txt

So I do have something like this so results are kept not overwritten:

>>Results.txt 

I've created the txt file so it'll write to it, this is what I tried and won't work:

findstr "\<%X%\>" *.txt  
echo >>results.txt

That is what I have for trying to log my results of my search term, however nothing happens.

And when I have findstr "\<%X%>" *.txt >>results.txt

It tries to search for >>results.txt and it's not cooperating.

Anyone know what to do?

I'm doing this because FINDSTR will work in the cmd prompt but if I get too many results it cuts off the top, so I want it to write all the results into the results.txt so I can view the whole results with nothing cut off.

Thanks for the help =)

Answer

i_am_jorf picture i_am_jorf · Dec 30, 2009

Try using /c:

findstr /c:"<%X%>" *.txt >> results.txt

Edit: didn't need the ^ escaping here.