Findstr command the Grep equivalent for Windows
It has been a while since I use a computer with Windows Operating System. However, I have no choice today since I'm working on a computer provided by client.
In the course of understanding the legacy codes....I need to search the legacy source codes with the grep command. Wait, there's no grep command in Windows!
A friend introduces this nifty tool - findstr
. The grep equivalent command in Windows world.
For example :
In Linux
$ ls -ls | grep filename
In Windows
c:\> dir | findstr filename
For multiple strings search with case insensitive example :
In Linux
$ ls -ls | grep -iE "testdata|lifo"
In Windows - empty space to replace pipe |
for multiple strings
c:\> dir | findstr -i "testdata lifo"
And to search through a list of file example
In Linux
$ grep searchtag -lr /path/directory
In Windows
c:\> findstr /M searchtag c:\directory\*
Hope this helps!
Reference :
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+13.8k Golang : Activate web camera and broadcast out base64 encoded images
+34.2k Golang : Create x509 certificate, private and public keys
+9.2k Golang : Gonum standard normal random numbers example
+8.4k Golang : Emulate NumPy way of creating matrix example
+9.8k Golang : Eroding and dilating image with OpenCV example
+5.2k Golang : Display packages names during compilation
+8.3k Android Studio : Rating bar example
+6.1k Fontello : How to load and use fonts?
+27.5k Golang : Convert CSV data to JSON format and save to file
+14.9k Golang : Find commonalities in two slices or arrays example
+28.7k Golang : Change a file last modified date and time
+8.1k Golang : Sort words with first uppercase letter