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
+6.9k Golang : Gargish-English language translator
+5.3k Golang : fmt.Println prints out empty data from struct
+12.9k Swift : Convert (cast) Int to String ?
+8.5k Golang : Another camera capture GUI application with GTK and OpenCV
+17.1k Golang : Find file size(disk usage) with filepath.Walk
+22k Golang : How to run Golang application such as web server in the background or as daemon?
+87k Golang : How to convert character to ASCII and back
+22.1k Golang : Securing password with salt
+27.4k PHP : Convert(cast) string to bigInt
+17.5k Golang : Parse date string and convert to dd-mm-yyyy format
+24.4k Golang : GORM read from database example
+4.6k Facebook : How to place save to Facebook button on your website