I have a text file in the format as below:
Demo
1
2
3
[[1]]
[[2]]
In a Powershell script, I'm trying to find the first line number where the string matches [[.
$path = 'C:\Demo\Test.txt'
$pattern = "Demo"
$LineNumber = Select-String $path -Pattern $pattern | Select-Object LineNumber
The above code returns the line number 1 as @{LineNumber=1}
But I'm mainly interested to get the line number where it starts from [[. How do I achieve this, the script fails if I use [[ in the pattern.
Kindly help, thanks for all the suggestions.