1

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 ;)

vbtheory
  • 373
  • 3
  • 17

3 Answers3

2

Try find "keyword" path:\to\file

seabeast
  • 181
  • 4
2

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"

npocmaka
  • 55,367
  • 18
  • 148
  • 187
0

In UNIX, grep does this.

In Windows, you can use Powershell commands for a grep equivalent.

Community
  • 1
  • 1
Jeanne Boyarsky
  • 12,156
  • 2
  • 49
  • 59