Without -Context option I could easily choose just select line without filename from Select-String results. But this is not a case when I use Select-String -Context x,y option.
Is there a way to hide filename from Context lines?
No, you can also run Select-String -context x,y ... | select line, providing -context parameter to Select-String, but you'll just omit the relevant context altogether in your output.
You seem to desire to override the default behavior of MatchInfo::ToString() writing filename with lines. You can do like this:
Select-String -Context x,y .... |
% {$_.context.precontext;$_.line;$_.context.postcontext}
This will output a set of strings with an unmarked matching line, but this should give you a start on formatting output of Select-String.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With