In our list of “CLI workaround for Windows XP“, a missing command is GREP. Now, you can have a GREP-Like command with the DOS command QGREP. Get the Windows Server 2003 Resource Kit tools on microsoft.com.
# display help
QGREP /?
usage: qgrep [-?BELOXlnzvxy][-e string][-f file][-i file][strings][files]
-? - print this message
-B - match pattern if at beginning of line
-E - match pattern if at end of line
-L - treat search strings literally (fgrep)
-O - print seek offset before each matching line
-X - treat search strings as regular expressions (grep)
-l - print only file name if file contains match
-n - print line number before each matching line
-z - print matching lines in MSC error message format
-v - print only lines not containing a match
-x - print lines that match exactly (-BE)
-y - treat upper and lower case as equivalent
-e - treat next argument literally as a search string
-f - read search strings from file named by next argument (- = stdin)
-i - read file list from file named by next argument (- = stdin)
White space separates search strings unless the argument is prefixed with -e, e.g., ‘qgrep “all out” x.y’ means find either “all” or “out” in x.y, while ‘qgrep -e “all out” x.y’ means find “all out”.
# Example for UNIX-Like regexp search
QGREP -X “[a-Z]” MYFILE.TXT
System Requirements
- Supported Operating Systems: Windows Server 2003; Windows XP
- 30 MB of free disk space
- Windows XP
- Windows XP SP1
- Windows Server 2003 family
Note: The Windows Server 2003 Resource Kit Tools are not supported on 64-bit platforms.