which gives me the desired output but a side effect of Select-String is the filename and line number is included in the output. How can I make my output appear the same as above using the -Context parameter? Stated differently, how can I make the output look exactly like the Select-String “Line” method?
I’m not completely sure if I got what exactly you want to get. If you’re not sure what property of the result you want you can simply output all properties like this: