Question i have a very long text file and im searhing only for spesfic sentences that have a word in it whats the best way to make those just show up?

Mitch_15

Reputable
Mar 31, 2017
81
0
4,530
0
i have a long text file and i dont want to go trough every thing to find what i need it would take me so long whats a easy way to just find what i need?
 

Mitch_15

Reputable
Mar 31, 2017
81
0
4,530
0
Can you give a sample of what kind of text you're searching for?

Also - are you somehow locked on software (i.e. at work/office) or are you free to install whatever you want (i.e. your own computer) ?
im searching for sentences with a specific word in them
 

gardenman

Admirable
Moderator
Use findstr at the command prompt.

Example:
findstr "location" "C:\users\Mitch\Desktop\TheFile.txt" > "C:\users\Mitch\Desktop\Only_Location_Lines.txt"

This will create a file on the desktop with all of the lines that have "location" in them (for example if your Windows user account name is Mitch). Be sure to use the correct path and filenames.

Note that
> "C:\users\Mitch\Desktop\Only_Location_Lines.txt"
redirects the output from the screen, and instead puts it in a file. You can leave that off if you want to see the output in the command prompt. That's a good way to test it first.
findstr "location" "C:\users\Mitch\Desktop\TheFile.txt"

Reference: https://www.windows-commandline.com/findstr-command-examples-regular/
 

ASK THE COMMUNITY