Remove line from text file

I have a text file located at c:\computers.txt. Â Inside this file is the following:


computer 345


computer 7 8 8

I want to delete a line from this file. Â The trick is, to delete only what I enter into a variable. Â So if $deletecomputer = ‘computer 345’ I want to delete just computer 345. Â The variable would could contain any one computername.

Everything I’ve found shows how to replace text. Â I’m not necessarily looking to replace. Â I’m looking to delete.

$Computers = Get-Content C:\computers.txt
$del = Read-Host -Prompt "Enter Computer name to delete"
$Computers = $Computers | Where {$_ -ne $del}
$Computers | Out-File C:\computers.txt -Force

Thank you.