vendredi 4 novembre 2016

Using powershell to search for a pattern

I am trying to write a powershell script to search for a pattern in a text file. Specifically I am looking at reading a file line by line and returning any line that has a space at the 32nd character position.

I have this so far but it just returns all lines that have white space. I need to narrow it down to the 32nd position

Get-Content -path C:\VM_names.txt | Where-Object {$_ -match "\s+"}

Aucun commentaire:

Enregistrer un commentaire