Get a line number on Powershell?
Select-String
returns the line number for you. You're just looking at the wrong property. Change your code to:
$search="Mustard"$linenumber= Get-Content thing.txt | select-string $search$linenumber.LineNumber
For people who are searching for one liner, code is self explanatory.
Get-Content .\myTextFile.txt | Select-String -Pattern "IamSearching" | Select-Object LineNumber