As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
Any recommendations on grep tools for Windows? Ideally ones that could leverage 64-bit OS.
I'm aware of Cygwin, of course, and have also found PowerGREP, but I'm wondering if there are any hidden gems out there?
FINDSTR is fairly powerful, supports regular expressions and has the advantages of being on all Windows machines already.
c:\> FindStr /?
Searches for strings in files.
FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
[/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]]
strings [[drive:][path]filename[ ...]]
/B Matches pattern if at the beginning of a line.
/E Matches pattern if at the end of a line.
/L Uses search strings literally.
/R Uses search strings as regular expressions.
/S Searches for matching files in the current directory and all
subdirectories.
/I Specifies that the search is not to be case-sensitive.
/X Prints lines that match exactly.
/V Prints only lines that do not contain a match.
/N Prints the line number before each line that matches.
/M Prints only the filename if a file contains a match.
/O Prints character offset before each matching line.
/P Skip files with non-printable characters.
/OFF[LINE] Do not skip files with offline attribute set.
/A:attr Specifies color attribute with two hex digits. See "color /?"
/F:file Reads file list from the specified file(/ stands for console).
/C:string Uses specified string as a literal search string.
/G:file Gets search strings from the specified file(/ stands for console).
/D:dir Search a semicolon delimited list of directories
strings Text to be searched for.
[drive:][path]filename
Specifies a file or files to search.
Use spaces to separate multiple search strings unless the argument is prefixed
with /C. For example, 'FINDSTR "hello there" x.y' searches for "hello" or
"there" in file x.y. 'FINDSTR /C:"hello there" x.y' searches for
"hello there" in file x.y.
Regular expression quick reference:
. Wildcard: any character
* Repeat: zero or more occurances of previous character or class
^ Line position: beginning of line
$ Line position: end of line
[class] Character class: any one character in set
[^class] Inverse class: any one character not in set
[x-y] Range: any characters within the specified range
\x Escape: literal use of metacharacter x
\<xyz Word position: beginning of word
xyz\> Word position: end of word
Example usage: findstr text_to_find * or to search recursively findstr /s text_to_find *
Based on recommendations in the comments, I've started using grepWin and it's fantastic and free.
(I'm still a fan of PowerGREP, but I don't use it anymore.)
I know you already mentioned it, but PowerGREP is awesome.
Some of my favorite features are:
Right-click on a folder to run PowerGREP on it
Use regular expressions or literal text
Specify wildcards for files to include & exclude
Search & replace
Preview mode is nice because you can make sure you're replacing what you intend to.
Now I realize that the other grep tools can do all of the above. It's just that PowerGREP packages all of the functionality into a very easy-to-use GUI.
From the same wonderful folks who brought you RegexBuddy and who I have no affiliation with beyond loving their stuff. (It should be noted that RegexBuddy includes a basic version of grep (for Windows) itself and it costs a lot less than PowerGREP.)
Additional solutions
Existing Windows commands
FINDSTR
Select-String in PowerShell
Linux command implementations on Windows
Cygwin
Cash
Grep tools with a graphical interface
AstroGrep
BareGrep
GrepWin
Additional Grep tools
dnGrep
GrepWin is free and open source (GPL)
I've been using grepWin which was written by one of the TortoiseSVN guys. It does the job on Windows...
Update July 2013:
Another grep tool I now use all the time on Windows is AstroGrep:
Its ability to show me more than just the line search (i.e. the --context=NUM of a command-line grep) is invaluable.
And it is fast. Very fast, even on an old computer with non-SSD drive (I know, they used to do this hard drive with spinning disks, called platters, crazy right?)
It is free.
It is portable (simple zip archive to unzip).
Original answer October 2008
Gnu Grep is alright
You can download it for example here: (site ftp)
All the usual options are here.
That, combined with gawk and xargs (includes 'find', from GnuWin32), and you can really script like you were on Unix!
See also the options I am using to grep recursively:
grep --include "*.xxx" -nRHI "my Text to grep" *
PowerShell's Select-String cmdlet was fine in v1.0, but it is significantly better for v2.0. Having PowerShell built in to recent versions of Windows means your skills here will always be useful, without first installing something.
New parameters added to Select-String: Select-String cmdlet now supports new parameters, such as:
-Context: This allows you to see lines before and after the match line
-AllMatches: which allows you to see all matches in a line (Previously, you could see only the first match in a line)
-NotMatch: Equivalent to grep -v o
-Encoding: to specify the character encoding
I find it expedient to create an function gcir for Get-ChildItem -Recurse ., with smarts to pass parameters correctly, and an alias ss for Select-String. So you an write:
gcir *.txt | ss foo
It may not exactly fall into the 'grep' category, but I couldn't get by on Windows without a utility called AgentRansack. It's a GUI-based "find in files" utility with regex support.
It's dead simple to right-click on a folder, hit "ransack.." and find files containing what you're looking for. It is extremely fast too.
Baregrep (Baretail is good too)
PowerShell has been mentioned a few times. Here is how you would actually use it in a grepish way:
Get-ChildItem -recurse -include *.txt | Select-String -CaseSensitive "SomeString"
It recursively searches all text files in the current directory tree for SomeString with case sensitivity.
Even better, run this:
function pgrep { param([string]$search, [string]$inc) Get-ChildItem -recurse -include $inc | Select-String -CaseSensitive $search }
Then do:
pgrep SomeStringToSearch *.txt
Then to really make it magical, add the function alias to your PowerShell Profile and you can almost dull the pain of not having proper command line tools.
Git on Windows = grep in cmd.exe
I just found out installing Git will give you some basic Linux commands: cat, grep, scp and all other good ones.
Install then add the Git bin folder to your PATH and then your cmd.exe has basic Linux functionality!
http://code.google.com/p/msysgit/downloads/list?can=3
I'd recommend AstroGrep.
It's free, open source, and has a simple interface. I use it to search code all the time.
ack works well on Windows (if you've got Perl). I find it better than grep for many uses.
dnGREP is an open source grep tool for Windows. It supports a number of cool features including:
Undo for replace
Ability to search by right clicking on folder in explorer
Advance search options such as phonetic search and xpath
Search inside PDF files, archives, and Word documents
IMHO, it has a nice and clean interface too :)
Cygwin includes grep. All the GNU tools and Unix stuff works great on Windows if you install Cygwin.
I always use WinGREP, but I've had issues with it not letting go of files.
Well, besides the Windows port of the GNU grep, there's also Borland's grep (very similar to the GNU one) available in the freeware Borland's Free C++ Compiler (it's a freeware with command-line tools).
I have successfully used GNU utilities for Win32 for quite some time and it has a good grep as well as tail and other handy GNU utilities for Win32. I avoid the packaged shell and simply use the executables right in Win32 command prompt.
The tail that is packaged is quite a good little application as well.
I'm the author of Aba Search and Replace. Just like PowerGREP, it supports regular expressions, saving patterns for further use, undo for replacements, preview with syntax highlight for HTML/CSS/JS/PHP, different encodings, including UTF-8 and UTF-16.
In comparison with PowerGREP, the GUI is less cluttered. Aba instantly starts searching as you are typing the pattern (incremental search), so you can experiment with regular expressions and immediately see the results.
You are welcomed to try my tool; I will be happy to answer any questions.
I wanted a free grep tool for Windows that allowed you to right click on a folder and do a regex search of every file - without any nag screen.
The following is a quick solution based on the findstr mentioned in a previous post.
Create a text file somewhere on your hard drive where you keep long lived tools. Rename to .bat or .cmd and paste the following into it:
#echo off
set /p term="Search term> "
del %temp%\grepresult.txt
findstr /i /S /R /n /C:"%term%" "%~1\*.*" > "%temp%\grepresult.txt"
start notepad "%temp%\grepresult.txt"
Then browse to the SendTo folder. On Windows 7 browse to %APPDATA%\Microsoft\Windows\SendTo and drag a shortcut of the batch file to that SendTo folder.
I renamed the shortcut to 1 GREP to keep it at the top of the SendTo list.
Things that I'd like to do next with this is pipe the output of findstr through something that would generate an html file so that you could click on each output line to open that file. Also, I don't think it works with shortcuts to folders. I'd have to inspect the parameter and see if it contains ".lnk".
My tool of choice is the appropriately named Windows Grep:
nice simple GUI
supports search and replace
can show the lines around the lines found
can search within columns in CSVs and fixed-width files
UnxUtils is the one I use, and it works perfectly for me...
I used Borland's grep for years, but I just found a pattern that it won't match. Eeeks. What else hasn't it found over the years? I wrote a simple text search replacement that does recursion like grep - it's FS.EXE on SourceForge.
grep fails...
C:\DEV> GREP GAAPRNTR \SOURCE\TPALIB\*.PRG
<no results>
Windows' findstr works...
C:\DEV> FINDSTR GAAPRNTR \SOURCE\TPALIB\*.PRG
\SOURCE\TPALIB\TPGAAUPD.PRG:ffSPOOL(cRPTFILE, MEM->GAAPRNTR, MEM->NETTYPE)
\SOURCE\TPALIB\TPPRINTR.PRG: AADD(mPRINTER, TPACONFG->GAAPRNTR)
\SOURCE\TPALIB\TPPRINTR.PRG: IF TRIM(TPACONFG->GAAPRNTR) <> TRIM(mPRINTER[2])
\SOURCE\TPALIB\TPPRINTR.PRG: REPLACE TPACONFG->GAAPRNTR WITH mPRINTER[2]
Another good choice is MSYS. It gives you a bunch of other GNU utilities to allow you to be more productive.
PowerShell's Select-String is similar. It does not have the same options and semantics, but it's still powerful.
I've been using AJC Grep daily for years. The only major limitation I've found is that file paths are limited to 255 characters and it stops when it encounters one, rather than just issuing a warning. It's annoying but doesn't happen very often.
I use it on 64-bit Windows 7 Ultimate, so its 64-bit credentials are fine.
GREP for Windows
I've been using it forever and luckily it's still available. It's super fast and very small.
If you want a simple-to-use Windows Grep tool, I created one called P-Grep that I have made available for free download from my website: www.adjutantit.com - home menu, downloads.
Windows Grep seemed to have problems with a large number of files, so I wrote my own - which seems more reliable. You can select a folder, right click and send it to P-Grep. The sendto folder gets updated during installation.
I have Cygwin installed on my machine and put the Cygwin bin directory in my environmental path, so the Cygwin grep works like normal in a command line which solves all my scripting needs for grep at the moment.
If none of the solutions is quite what you are looking for, perhaps you could write a wrapper to FindStr that does exactly what you require?
FindStr is pretty good anyway so it should just be knocking a GUI up (if you want it) and providing a few extra features (like combining it with Find to find the count of files which contain a specified string [mentioned above]).
This, of course, assumes you have the requirement, time and inclination to do this!
Related
I have some shell scripts created on Windows.
I want to run dos2unix on them.
I have read that dos2unix works on Linux.
Is there a way that I can convert my files to having Unix newlines while working on Windows?
You can use Notepad++.
The instructions to convert a directory recursively are as follows:
Menu: Search -> Find in Files...
Directory = the directory you want to be converted to Unix format, recursively. E.g., C:\MyDir
Find what = \r\n
Replace with = \n
Search Mode = Extended
Press "Replace in Files"
Solved it trough Notepad++.
Go to: Edit -> EOL Conversion -> Unix.
If you have perl installed, you can simply run:
perl -i -p -e "s/\r//" <filename> [<filename2> ...]
There are at least two resources:
dos2unix on SourceForge, which appears to be actively maintained (as of 2015), and has pre-compiled releases for Windows, both 32- and 64-bit. Also includes unix2dos, mac2unix, and unix2mac.
CygUtils from GnuWin32, which are miscellaneous utilities forked from Cygwin, which includes dos2unix as well as several other related utilities. This package is not actively maintained (last update was in 2008).
In PowerShell there are so many solutions, given a lot of tools in the .NET platform
With a path to file in $file = 'path\to\file' we can use
[IO.File]::WriteAllText($file, $([IO.File]::ReadAllText($file) -replace "`r`n", "`n"))
or
(Get-Content $file -Raw).Replace("`r`n","`n") | Set-Content $file -Force
It's also possible to use -replace "`r", "" instead
To do that for all files just pipe the file list to the above commands:
Get-ChildItem -File -Recurse | % { (Get-Content -Raw `
-Path $_.Fullname).Replace ("`r`n", "`n") | Set-Content -Path $_.Fullname }
See
how to convert a file from DOS to Unix
How to convert DOS line endings to UNIX on a Windows machine
Powershell v2: Replace CRLF with LF
For bigger files you may want to use the buffering solutions in Replace CRLF using powershell
I used grepWin:
Open the folder containing your files in grepWin
In the "Search for" section
select "Regex search"
Search for -> \r\n
Replace with -> \n
Hit "Search" to confirm which files will be touched, then "Replace".
The search and replace Regex didn't work for me for whatever reason, however solved on single file (~/.bashrc) in Notepad++ by setting Encoding --> UTF-8 and resaving. Not as scalable but hopefully saves some headaches for quick conversion.
Open the file using Notepad++
Hit Ctrl+F
Select search mode as "Regular Expression"
Search for -> \r\n
Replace with -> \n
Hit "Replace all" under the "Replace tab"
if the above doesn't work -
mvn clean install
I realize this may be a bit of a contextual leap, but I'll share my thought anyway since it just helped in my use case...
If the file will live in a git repo, you can enforce the line endings on it via a .gitattributes file. See: how to make git not change line endings for one particular file?
You are using a very old dos2unix version on Cygwin. Cygwin 1.7 changed to a new version of dos2unix, the same as is shipped with most Linux distributions, about two years ago. So update your dos2unix with Cygwin's setup program. Check you get version 6.0.3.
There are also native Windows ports of dos2unix available (win32 and win64).
See http://waterlan.home.xs4all.nl/dos2unix.html
regards,
Any good text editor on Windows supports saving text files with just line-feed as line termination.
For an automated conversion of text files from DOS/Windows to UNIX line endings the batch file JREPL.BAT can be used which is written by Dave Benham and is a batch file / JScript hybrid to run a regular expression replace on a file using JScript working even on Windows XP.
A single file can be converted from DOS/Windows to UNIX using for example:
jrepl.bat "\r" "" /M /F "Name of File to Modify" /O -
In this case all carriage returns are removed from the file to modify. It would be of course also possible to use "\r\n" as search string and "\n" as replace string to remove only a carriage return left to a line-feed if the file contains carriage returns also somewhere else which should not be removed on conversion of the line terminators.
Multiple files of a directory or an entire directory tree can be converted from DOS/Windows to UNIX text files by using command FOR to CALL batch file JREPL.BAT on each file matching a wildcard pattern.
Batch file example to convert all *.sh files in current directory from DOS/Windows to UNIX.
#for %%I in (*.sh) do #call "%~dp0jrepl.bat" "\r" "" /M /F "%%I" /O -
The batch file JREPL.BAT must be stored in same directory as the batch file containing this command line.
For understanding the used commands and how they work, open a command prompt window, execute there the following commands, and read entirely all help pages displayed for each command very carefully.
jrepl.bat /?
call /?
for /?
I have some shell scripts created on Windows.
I want to run dos2unix on them.
I have read that dos2unix works on Linux.
Is there a way that I can convert my files to having Unix newlines while working on Windows?
You can use Notepad++.
The instructions to convert a directory recursively are as follows:
Menu: Search -> Find in Files...
Directory = the directory you want to be converted to Unix format, recursively. E.g., C:\MyDir
Find what = \r\n
Replace with = \n
Search Mode = Extended
Press "Replace in Files"
Solved it trough Notepad++.
Go to: Edit -> EOL Conversion -> Unix.
If you have perl installed, you can simply run:
perl -i -p -e "s/\r//" <filename> [<filename2> ...]
There are at least two resources:
dos2unix on SourceForge, which appears to be actively maintained (as of 2015), and has pre-compiled releases for Windows, both 32- and 64-bit. Also includes unix2dos, mac2unix, and unix2mac.
CygUtils from GnuWin32, which are miscellaneous utilities forked from Cygwin, which includes dos2unix as well as several other related utilities. This package is not actively maintained (last update was in 2008).
In PowerShell there are so many solutions, given a lot of tools in the .NET platform
With a path to file in $file = 'path\to\file' we can use
[IO.File]::WriteAllText($file, $([IO.File]::ReadAllText($file) -replace "`r`n", "`n"))
or
(Get-Content $file -Raw).Replace("`r`n","`n") | Set-Content $file -Force
It's also possible to use -replace "`r", "" instead
To do that for all files just pipe the file list to the above commands:
Get-ChildItem -File -Recurse | % { (Get-Content -Raw `
-Path $_.Fullname).Replace ("`r`n", "`n") | Set-Content -Path $_.Fullname }
See
how to convert a file from DOS to Unix
How to convert DOS line endings to UNIX on a Windows machine
Powershell v2: Replace CRLF with LF
For bigger files you may want to use the buffering solutions in Replace CRLF using powershell
I used grepWin:
Open the folder containing your files in grepWin
In the "Search for" section
select "Regex search"
Search for -> \r\n
Replace with -> \n
Hit "Search" to confirm which files will be touched, then "Replace".
The search and replace Regex didn't work for me for whatever reason, however solved on single file (~/.bashrc) in Notepad++ by setting Encoding --> UTF-8 and resaving. Not as scalable but hopefully saves some headaches for quick conversion.
Open the file using Notepad++
Hit Ctrl+F
Select search mode as "Regular Expression"
Search for -> \r\n
Replace with -> \n
Hit "Replace all" under the "Replace tab"
if the above doesn't work -
mvn clean install
I realize this may be a bit of a contextual leap, but I'll share my thought anyway since it just helped in my use case...
If the file will live in a git repo, you can enforce the line endings on it via a .gitattributes file. See: how to make git not change line endings for one particular file?
You are using a very old dos2unix version on Cygwin. Cygwin 1.7 changed to a new version of dos2unix, the same as is shipped with most Linux distributions, about two years ago. So update your dos2unix with Cygwin's setup program. Check you get version 6.0.3.
There are also native Windows ports of dos2unix available (win32 and win64).
See http://waterlan.home.xs4all.nl/dos2unix.html
regards,
Any good text editor on Windows supports saving text files with just line-feed as line termination.
For an automated conversion of text files from DOS/Windows to UNIX line endings the batch file JREPL.BAT can be used which is written by Dave Benham and is a batch file / JScript hybrid to run a regular expression replace on a file using JScript working even on Windows XP.
A single file can be converted from DOS/Windows to UNIX using for example:
jrepl.bat "\r" "" /M /F "Name of File to Modify" /O -
In this case all carriage returns are removed from the file to modify. It would be of course also possible to use "\r\n" as search string and "\n" as replace string to remove only a carriage return left to a line-feed if the file contains carriage returns also somewhere else which should not be removed on conversion of the line terminators.
Multiple files of a directory or an entire directory tree can be converted from DOS/Windows to UNIX text files by using command FOR to CALL batch file JREPL.BAT on each file matching a wildcard pattern.
Batch file example to convert all *.sh files in current directory from DOS/Windows to UNIX.
#for %%I in (*.sh) do #call "%~dp0jrepl.bat" "\r" "" /M /F "%%I" /O -
The batch file JREPL.BAT must be stored in same directory as the batch file containing this command line.
For understanding the used commands and how they work, open a command prompt window, execute there the following commands, and read entirely all help pages displayed for each command very carefully.
jrepl.bat /?
call /?
for /?
I need to search through a log file based on the previous days date and then search for the keyword "ERROR-xxx" for that date. If an error is found, it needs to be copied to a seperate log file. (Not sure if this helps, but previous days entries are always at the end of the file).
I am trying to do this using command-line as it needs to be scripted/automated. Not sure how this can be done in Windows.
Any ideas? Thanks in advance for your help.
Here is a good place to find batch files for date manipulation this coupled with the findstr tool specifically:
findstr /c "%yesterday%" | findstr /r "ERROR-%xxx%" logfile.log
/c matches a literal string (can contain spaces)
/r lets you parse regular expressions (similar to grep in unix) this should get you to a scripted solution.
I would like to find a replacement for list.com, specifically the ability to accept piped input. For example:
p4 sync -n | list
which accepts the output of the perforce command and displays the results in the viewer/editor for manipulation or saving. I know that I would send the output to a file and then open the file in the viewer/editor but I use it for temporary results.
List.com doesn't work on 64 bit Windows 7.
A good 32-bit Windows-based alternative to Vern Buerg's List is Charles Prineas' "V". Find it at http://www.fileviewer.com.
I believe someone is working on a replacment. See http://mysite.verizon.net/yellowspoon
The less utility can display text read from standard input. You can download 32-bit Windows binaries of the program, and Microsoft claims most programs designed for a computer running a 32-bit version of Windows will work on a computer running 64-bit versions of Windows.
You can simulate list.com file browsing and viewing features with vifm and less.
They are both freely available for windows.
After vifm installation just customize the "vi command" in the configuration file, and replace it with "less" (set vicmd = less \ -C)
You can also have a single pane display if you prefer so (with the "only" option).
Finally you can create a list.bat which calls vifm and changes the current directory on exit. This is the batch file content.
#echo off
for / f "delims =" %% i in ('vifm --choose-dir -% 1') do IF "%%i" NEQ "" (cd %%i)
More details in list.com lives on my blog
What is that one not usually known command in unix and windows that you know?
It is heard that windows contains several hidden applications which sometimes
may be very useful.
linux:
history (history of command line)
mogrify (for all image needs/operations)
screen (for running programs after logging off via ssh)
In widows XP if you have ever tried to do somthing like this
cd \\pc\c$
You will have recieved the error
CMD does not support UNC paths as current directories.
Well you can use UNC paths as long as you map them to a temp drive letter like so.
pushd \\pc\c$
Then when you want to return simply...
popd
Windows:
fdisk /mbr
Saved my life (and system) after a Linux partition went berserk.
Linux:
strace
Came handy getting passwords with classmates running a telnet from a shell I was logged in ;-)
I'm not sure if this counts as unknown, but rsync is invaluable.
In older versions of Windows (XP, in particular), I found the shutdown command invaluable. For example:
shutdown /s /t 3600
will shut down the computer in an hour. Linux, of course, has a similar command (I'd say the majority of Linux users are intimately familiar with "shutdown -h now"), but the Windows equivalent is less well known.
The reason I mentioned older versions of Windows is that in newer ones (Vista I know for sure, don't know about Windows Server 200x) the functionality of shutdown has been hobbled a bit. For example, you can only set a maximum wait time of ten minutes, which makes it useless if you want your computer to shut down in an hour or two, when a download is done.
The hosts file can be used to filter online advertising.
In bash's ~/.bashrc file:
set -o vi
and in ~/.inputrc
set editing-mode vi
set keymap vi
Also, Using !$ to avoid retyping:
ls long/dir/name/i/dont/want/to/repeat/file.txt
rm !$
In Unix: apropos (rough idea of what you want) | less
On Windows XP+:
fsutil, the file system utility. I use this when I have to create test files of a specific size (fsutil file createnew <filename> <length>).
netstat, Displays protocol statistics and current TCP/IP network connections.
netsh, the network services shell; command line hook into all sorts of network info.
reg, the registry shell, for working with the registry from the command line.
on windows i used to like gpedit.msc but i think its only on certain versions of xp
and regedit of course
mmc.exe
you can do amazing things with the bare-bone version of the management console, given admin access to some machines in a network.
In PowerShell, you can:
cd \\server\c$\
In Windows, I use SET alot to get the basic information of the computer easily. There's also: IPCONFIG /FLUSHDNS, IPCONFIG /REGISTERDNS (to clear and reload dns entries), TRACERT (used to trace a path between your location and another on the network/internet), NETSTAT -s -p tcp (for network statistics), and PATHPING (like ping but better!)
I find that findstr is relatively unknown, at least I didn't know about it. It's a rough equivalent to grep, nice when you're not necessarily wanting or needing to install something like mingw or cygwin or even a natively built grep.
c:\Users\logan>findstr /?
Searches for strings in files.
FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
[/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]]
strings [[drive:][path]filename[ ...]]
/B Matches pattern if at the beginning of a line.
/E Matches pattern if at the end of a line.
/L Uses search strings literally.
/R Uses search strings as regular expressions.
/S Searches for matching files in the current directory and all
subdirectories.
/I Specifies that the search is not to be case-sensitive.
/X Prints lines that match exactly.
/V Prints only lines that do not contain a match.
/N Prints the line number before each line that matches.
/M Prints only the filename if a file contains a match.
/O Prints character offset before each matching line.
/P Skip files with non-printable characters.
/OFF[LINE] Do not skip files with offline attribute set.
/A:attr Specifies color attribute with two hex digits. See "color /?"
/F:file Reads file list from the specified file(/ stands for console).
/C:string Uses specified string as a literal search string.
/G:file Gets search strings from the specified file(/ stands for console).
/D:dir Search a semicolon delimited list of directories
strings Text to be searched for.
[drive:][path]filename
Specifies a file or files to search.
Use spaces to separate multiple search strings unless the argument is prefixed
with /C. For example, 'FINDSTR "hello there" x.y' searches for "hello" or
"there" in file x.y. 'FINDSTR /C:"hello there" x.y' searches for
"hello there" in file x.y.
Regular expression quick reference:
. Wildcard: any character
* Repeat: zero or more occurrences of previous character or class
^ Line position: beginning of line
$ Line position: end of line
[class] Character class: any one character in set
[^class] Inverse class: any one character not in set
[x-y] Range: any characters within the specified range
\x Escape: literal use of metacharacter x
\<xyz Word position: beginning of word
xyz\> Word position: end of word
For full information on FINDSTR regular expressions refer to the online Command
Reference.
I just thought to put this in as I used it today about on 5 windows XP machines.
systeminfo
Gives you a list of your system details including os, hotfix/updates, hardware and network information. Sure you can get all this information in a lot of other places, either with commands or in the GUI but this is a great command to find out a lot about a machine very quickly.