I have gawk installed on my Windows 10 machine, but no grep, but still needed to quickly find text in some files.
So I came up with (read: “found on the internet”) this one-liner
@for /f "eol=: delims=" %F in ('dir /b /s [directory]') do
@awk "/[search string]/ {print $0}" %F
Usually I use grepWin for such tasks, but only later realized that a simply Ctrl-C would copy the selected search result to the clipboard – grepWin’s context menu does not have a menu item for this function, even though it has been suggested in a related issue.
I also noticed grepWin has a memory problem if you search huge files on a machine with little RAM. On the other hand, it searches using the Windows codepage rather than the DOS codepage.
It is also easy to use PowerShell which has good regex support.
Get-ChildItem -File -Recurse -path ‘C:/src’ | ForEach-Object { Select-String -Pattern ‘exit’ -Path $_ }^C
If you are desperate to push as few buttons as possible, aliases can be used. Just don’t put them into a script.
gci -file -rec ‘C:/src’ | %{sls ‘search string’ $_}