This is a 'continuation' of this
Originally, I had asked that, given a list of keywords, and a pointer to a folder, I would like to display all occurrences of where any of the keywords were found, and indicate if no matches were found for that keyword. I have over 300 keywords and about 250 SQL scripts that make up several hundred thousand lines of code, so I am changing the requirements somewhat (although I am impressed how fast PowerShell does this).
The reason for showing lines that included the keywords was so I could check for scenarios where a substring was found (like I_FIS as a keyword found in I_FIS_REJECT), but the output is overwhelming.
Having executed the code suggested in the above link, I am refining the parameters.
First of all, the keywords are table names, and I am checking code to see if the table is referenced. As such, the keyword would almost always be either a full word (such as SELECT * FROM mytable) or be prefixed with a period (.), such as SELECT * FROM dbo.mytable). There should always be whitespace in the form of a space or CR/LF following the keyword, as shown by these examples:
WHERE 1 = 1
FROM mytable t
WHERE 1 = 1
I want the search and report to be case insensitive, such that, if my keyword is "mytable", "MyTable" and "MYTABLE" count as a match, and I want to report where the keyword is NOT FOUND.
My original request just stated that I would search a folder and subfolders for any file, but I only want to search files with a file type of ".SQL"
The output only has to list the keywords from the list that were not found in any of the scripts.