GREP Unix command

G

Guest

Whats the Unix GREP command equivalent in Windows?
Is there any alternative command which can be used like GREP?

I am looking for a Microsoft inbuilt solution instead of installing any
third-party tools.

Please advice.
 
O

Opinicus

Whats the Unix GREP command equivalent in Windows?
Is there any alternative command which can be used like GREP?
I am looking for a Microsoft inbuilt solution

There's an old DOS command findstr that will do something like grep. From a
command prompt type:

findstr /? > findstr.txt

Open and read findstr.txt for information about how this antique works.
 
O

Opinicus

Kamlesh said:
Whats the Unix GREP command equivalent in Windows?
Is there any alternative command which can be used like GREP?

Oops. Also the DOS command "find".
 
F

FrankV

There is a DOS 'grep' from way back in the '80s where there was a library of
many standard UNIX comands for DOS. Each time I get a new computer the first
thing I do is download all the programs. Here is the "grep /?" response:

Name: grep - regular expression search through files
Usage: grep [ -vclins? ] <pattern> file1 ...
Version: 2.0 for PCs with DOS 2.1 and higher
(C) Copyright Peter Stephen Heitman 1986 -- All Rights Reserved
Distributed with the PiCnix Package (tm) by Peter Stephen Heitman
Regular expression pattern matching algorithm:
Copyright (c) 1986 by University of Toronto.
Written by Henry Spencer. Not derived from licensed software.

The options for grep are:

-v: print the lines that DON'T match the pattern
-c: print a count of the number of matches in each file
-l: print the name of each file that has a match
NOTE: options v, c and l are exclusive. Only one of these may be selected

-i: ignore the case of each character while matching
-n: print the line number that the match occurred on
-s: do not report errors encountered while opening or reading files
-?: print this description of the program.

The 'PiCnix Package (tm)' can be downloaded from
http://sourceforge.net/project/showfiles.php?group_id=41329.

Frank
 
P

Paul Johnson

Opinicus said:
Oops. Also the DOS command "find".

I didn't get the original post since Opinicus posted from the web board and
my news server drops those posts (Opinicus might want to try posting from
nntp://msnews.microsoft.com/microsoft.public.windowsxp.general in the
future).

DOS find doesn't really compare. What Opinicus is looking for is GNU Grep,
which is part of the free (as in your rights) software Cygwin bundle,
available from Red Hat at http://www.cygwin.com/setup.exe
 
A

arachnid

I didn't get the original post since Opinicus posted from the web board
and my news server drops those posts (Opinicus might want to try posting
from nntp://msnews.microsoft.com/microsoft.public.windowsxp.general in the
future).

DOS find doesn't really compare. What Opinicus is looking for is GNU
Grep, which is part of the free (as in your rights) software Cygwin
bundle, available from Red Hat at http://www.cygwin.com/setup.exe

UnxUtils contains ports of common GNU utilities to native Win32.
Unlike cygwin, no emulation layer is required. Here's the URL:

http://unxutils.sourceforge.net/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top