findstr to search a text file for matching strings
I've posted about findstr in the past on July 5, 2016, when I explained how to use the Windows command to search for specified string, and on July 6, 2016 when I discussed how to search just the beginning or ending of text files. This night's tips shows how you can use findstr to search through one long text for a list of terms in another text file.
We write the command this way, after pressing SHIFT + CTRL right click, and choosing 'Open command window here' from the menu which appears.
findstr /X /G:bountyhunters.txt characterlist.txt >results.txt
. . . so findstr is the command; the operator /X tells it to look for lines that match exactly; /G: specifies the file containing the strings you want to look for; the text file you're searching comes next; and with > we specify an output file.
So this is the text file we search through:
. . . this file is the one with the strings we're looking for:
. . . here's the command in action:
. . . and we end up with these results.