GNU Grep on Windows XP

Gadrin <[email protected]> Tue, 9 Dec 2008 11:45:31 -0800 (PST)
Newsgroups gmane.comp.gnu.utils
Organization http://groups.google.com
Message-ID <[email protected]>
rem		I've downloaded the page at http://forums.mysql.com/index.php
rem		and saved it to the MYSQL-Index.html file below. I wanted to
rem		use GNU GREP to grab all the <a> with the current date in them
rem		so I can see out of the myriad of forums which ones have current
rem		posts in them. Using DOS Batch file.

rem		The first GREP works fine, but the 2nd one I'm getting:
rem		grep: >: Invalid argument
rem		grep: J:\Temporary\Forums-2.html: No such file or directory

rem		as it can't seem to split the PATTERN and the redirection
character
rem		and thinks the last is another input file.

rem		I've tried quoting the ?, placing filenames inside of "%Out1% and
rem		even escaping the ^> or \> but it doesn't work. Anyone have a
clue?

set Index1=C:\zCDROMS\wbtTemp\MySQL-Index.html
set Out1=J:\Temporary\Forums.txt
set Out2=J:\Temporary\Forums-2.html

grep -B10 "forum-last-post.*>December 09" %Index1% > %Out1%
grep "php?[0-9].\"" %Out1% > %Out2%