The Computer Oracle

Grep equivalent for Windows 7?

Tech terms, remembered forever. Memorabit: https://memorab.it/y/pc

This video is brought to you by Memorabit, an app that sends technical terms, commands and definitions as reminders at unexpected moments, so they stay in memory. Built on cognitive science principles. Start free on web, iOS and Android:
iOS: https://apps.apple.com/app/id6782301691
Android: https://play.google.com/store/apps/detai...
--------------------------------------------------
Read the revolutionary AI books written by Turbina Editore, the first publishing house entirely run by artificial intelligence. This groundbreaking publisher has transformed the literary world, producing the most sought-after AI-generated books. Start reading today at:
https://turbinaeditore.com/en/
--------------------------------------------------

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT


Music by Eric Matyas
https://www.soundimage.org
Track title: Music Box Puzzles

--

Chapters
00:00 Grep Equivalent For Windows 7?
00:20 Accepted Answer Score 338
00:36 Answer 2 Score 26
01:46 Answer 3 Score 10
02:02 Answer 4 Score 51
03:35 Thank you

--

Full question
https://superuser.com/questions/300815/g...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows7 #grep #cmdexe

#avk47



ACCEPTED ANSWER

Score 338


Findstr sounds like what you want. I use it all the time as an approximate grep-equivalent on the Windows platform.

Another example with pipes:

C:\> dir /B | findstr /R /C:"[mp]"



ANSWER 2

Score 51


There are several possibilities:

  • Use a port of a Unix grep command. There are several choices. Oft-mentioned are GNUWin32, cygwin, and unxutils. Less well known, but in some ways better, are the tools in the (now discontinued) SFUA utility toolkit, which run in the Subsystem for UNIX-based Applications that comes right there in the box with Windows 7 Ultimate edition and Windows Server 2008 R2. (For Windows XP, one can download and install Services for UNIX version 3.5.) This toolkit has a large number of command-line TUI tools, from mv and du, through the Korn and C shells, to perl and awk. It comes in both x86-64 and IA64 flavours as well as x86-32. The programs run in Windows' native proper POSIX environment, rather than with emulator DLLs (such as cygwin1.dll) layering things over Win32. And yes, the toolkit has grep, as well as some 300 others.
  • Use one of the many native Win32 grep commands that people have written and published. Tim Charron has a native Win32 version of a modified GNU grep, for example. There are also PowerGREP, Bare Grep, grepWin, AstroGrep, and dnGrep, although these are all GUI programs not TUI programs.
  • Use the supplied find and findstr. The syntax is different to that of grep, note, as is the regular expression capability.



ANSWER 3

Score 26


In your early revision you wrote MS-DOS, there's only FIND, as far as I know. But it's an ancient OS not used anymore.

In the Windows NT command prompt(e.g. Win2K and win XP and later, so e.g. win7,win10), you can use find and findstr and if you download GnuWin32 then grep

The basic differences are that findstr has some regular expressions support. Grep supports regular expressions best.

C:\>dir | find "abc"
C:\>dir | find /i "abc"

find /? and findstr /?shows you what the switches do.

Gnuwin32 has "packages". If you download GnuWin32, I suggest the coreutils package for a bunch of basic useful utilities you'd be familiar with, but grep isn't in that one it's its own package.

Added

GnuWin32's grep, last time I checked, is old. Cygwin's grep is far more up to date. Also bear in mind that many people use Virtual Machines rather than windows ports of *nix commands.




ANSWER 4

Score 10


If you would rather use grep, rather than findstr, there is a single .exe file version in UnxUtils, so it's portable and there is no need to install it, or use something like Cygwin.