You are not logged in.
Pages: 1
Goal:
1. Parse a text file for text string: "Order No: Foo bar"
2. Strip "Order No: " out and leave me with "Foo bar" in a variable.
> $ON = (Get-Content -Path .\myfile.txt) -match "Order No: "
> Write-Output $ON
Order No: Foo bar
I've attempted to use $ON.IndexOf to separate it, based on this example I found:
$pos = $name.IndexOf(";")
$leftPart = $name.Substring(0, $pos)
$rightPart = $name.Substring($pos+1)
but I get an error:
Method invocation failed because [System.Object[]] doesn't contain a method named 'IndexOf'.
Offline
Pages: 1