Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Reading text file with -context

$
0
0

Hi,

I am reading file with select-string and capturing lines which I need using -context. I am stuck how to remove file name and line number in the output

PS E:\> Get-Content .\num.txt
one
two
three
four
five
six
seven
eight
nine
ten
three
eleven
twelve
13
14
15
PS E:\> Select-String .\num.txt -Pattern two -Context 0,3

> num.txt:2:two
  num.txt:3:three
  num.txt:4:four
  num.txt:5:five


PS E:\>


Viewing all articles
Browse latest Browse all 8411

Latest Images

Trending Articles



Latest Images