24664

Question:
I have a file full of lines like the one below, I would like to use powershell to delete everything after the first "<" in every line in the file
"10.0.0.1","pc1","Microsoft Windows Server 2008 SP2 <100%-accuracy> Microsoft Windows 7 SP0 - SP1, Windows Server 2008 SP1, or Windows 8 <100%-accuracy>"
"10.0.0.2","pc2","Microsoft Windows Server 2008 SP2 <100%-accuracy> Microsoft Windows 7 SP0 - SP1, Windows Server 2008 SP1, or Windows 8 <100%-accuracy>"
"10.0.0.3","pc3","Microsoft Windows Server 2008 SP2 <100%-accuracy> Microsoft Windows 7 SP0 - SP1, Windows Server 2008 SP1, or Windows 8 <100%-accuracy>"
Answer1:Here is an example of how to truncate a line at a certain delimiter:
$line = '"10.0.0.1","pc1","Microsoft Windows Server 2008 SP2 <100%-accuracy> Microsoft Windows 7 SP0 - SP1, Windows Server 2008 SP1, or Windows 8 <100%-accuracy>"'
$linetruncated = $line.Substring(0,$line.IndexOf('<'))