I'm using powershell to "grep" my source code for a particular string. If the string is in the file, I would like the name of the file, not the line of code that contains the string.
I would also like the name of the file, just once, not listed for as many times as the file exists.
I'm currently using:
gci . -include "*.sql" -recurse | select-string -pattern 'someInterestingString'
Now I understand that the output of select-string is some sort of ojbect, and what I'm seeing in the console is, i'm guessing, the ToString()
of that object. I assume that I could use format-table
to control the output of the select-string, and I suppose sort
to get distinct values only.
but that's a lot of guessing.