Page 1 of 1

Doing text searches to find markup: find an findstr commands

Posted: Thu Dec 10, 2020 9:41 am
by j.ylioja
The information I have been studying on searching for markup in the html content of an EPUB discusses using the find command from within PowerShell, using the syntax:
find "text" *
to search for text in all files.
For some reason, in PowerShell, the text needs to have a space at the beginning or end for the command to work properly. However in Command Prompt it works without a space. I suspect it may have something to do with how quotes are used in PowerShell, but my PowerShell knowledge is very little. I also found the findstr command, which has similar syntax but lists the results slightly differently. Instead of listing the filename followed by a line for each result, it lists the filename at the start of the line followed by the result. It also doesn't list the filenames where the result doesn't appear. The output from find will list all the files that were searched regardless on whether the result was found. findstr also has more flexibility in the text that is searched for, in that it also allows regular expressions, which allow searching for a pattern in addition to a specific string of text. So far I haven't found a need for regular expressions in the basic searches I've done. Does anyone else have experience with this, or any other useful tips for bulk searching?