I need some way to show the lines of text file that contain a certain keyword.
It's usually TYPE path:\to\file
but I want it to show all lines that contain a keyword of choice.
Regard ;)
I need some way to show the lines of text file that contain a certain keyword.
It's usually TYPE path:\to\file
but I want it to show all lines that contain a keyword of choice.
Regard ;)
find "keyword" path:\to\file
or findstr /c:"keyword" path:\to\file
are options.
If you want to clear the ---------- FileName
part of the output you can use
type path:\to\file | find "keyword"
or
type path:\to\file | findstr /c:"keyword"
to show line numbers use /n
type path:\to\file | find /n "keyword"
or
type path:\to\file | findstr /n /c:"keyword"
EDIT
foxidrive reminded another way (see the comment):
find "keyword" < "path:\to\file"
In UNIX, grep does this.
In Windows, you can use Powershell commands for a grep equivalent.