grep is the most used and powerful command line tool available for Unix and Linux Distributions, if you are a Windows Operating System and wondering if there is a similar or alternative to grep for Command Line - CMD or PowerShell, well findstr is the command you should look at.Example: grep vs findstr:
# ls| grep sample.txt
C:\> dir | findstr sample.txt
Some Findstr Examples
To find the word Michael in songs.txt file.
> findstr Micheal songs.txt
To find the word Easter or Christmas in songs.txt file.
> findstr Easter Christmas songs.txt
To find the String Micheal Jackson in songs.txt file.
> findstr "Micheal Jackson" songs.txt
Case insensitive search /i
> findstr /i "Micheal Jackson" songs.txt
. Wildcard - Any character * Repeat - Zero or more occurrences of the previous character. ^ Beginning line position - Beginning of the line. $ End of the line. [x-y] Range - Any characters within the specified range. \x Escape - Literal use of a meta-character. \
Ending word position
Read More: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/findstr
Have Questions? Post them here!
More Posts related to Windows,
- Grep Alternative for Windows CMD or PowerShell: findstr
- Fix Windows Update Install Error 0x80070005
- Read file from Windows CMD (Command Line)
- Cannot access Windows application shortcuts on Start menu and Taskbar
- sudo is not recognized as an internal or external command
- Minecraft Fix: Error: UNKNOWN code: Deep Ocean - Something went wrong in the login process
- Cmd command get current directory location
- [Fix] Microsoft Windows OneDrive 0x8007018b Error Code
- [Solution] The connection to the remote PC was lost, preparing to reconnect - Windows RDP
- [Fix] Microsoft Windows Store error 0x00000005 (Windows 8/10/11)
- Fix Windows Update Error Code: 0x80070643
- Fix: Error code: 0x204 Microsoft Remote Desktop - Unable to connect the remote PC.
- [Solved] SharePoint Search Internal server error exception - SharePoint
- How to Open Finder using Mac Terminal - MacOS
- [fix] Docker - no matching manifest for linux/arm64/v8 in the manifest list entries [M/M2 Mac] - Docker
- Java Read and Write Properties file with Examples - Java
- How to add multiple spaces between html page text - Html
- AlertDialog with no buttons (just text message) - Android
- osascript wants to make changes while Android Studio Installation on Mac OS X - Mac-OS-X
- How to remove password from pdf file - HowTos