"use the command line tool "for" and "findstr":
for /r %i in (*.txt) do @for /f "tokens=1-3 delims=:" %a in ('findstr /r "foo.*bar" %i ^| findstr /b ":"') do
@echo %i:%c
... who shall remember this?? and it just produces:
syntax error at unexpected word '%i' !
Alternatively, you can use the "powershell" command, the basic syntax is:
Get-ChildItem -Path "C:\path\to\folder" -Filter *.txt -Recurse -Force | Select-String -Pattern "foo.*bar" -Context 0,1 | % { $_.Context.PostContext[0] }
... produces no output. Should that be a starting point for hour-long trial and error?
Great solution! ... if you have an alien neighbour who can translate it for humans.
But if he can't, you're rather lost, and need the
Forget the above junk, download the free open source SFK for any system and type in one line:
sfk xfind -pure mydir "/foo*bar/[part2]\n/"
Done. Example output:
:file mydir\log1.txt
and the
:file mydir\log2.txt
with some
Secret command discovered!
How to list all files having a word in their filename
Big mystery uncovered!
How to list the newest files in a folder