Domain Update: Our Forum has moved! Please visit us at Holisticz.com for the latest updates.
(24 October, 2019 - 08:38 PM)Lucian Wrote: Show More
title
(24 October, 2019 - 08:44 PM)Lucian Wrote: Show More
Got 12k lines with different captures. the replace method won't work
$InputPath = "C:\temp\ComboWCapture.txt"
$OutputPath = "C:\temp\ComboNoCapture.txt"
$sw = New-Object System.IO.StreamWriter $OutputPath
$cnt = 0
foreach ($line in [System.IO.File]::ReadLines($InputPath))
{
$cnt++
if($cnt % 1000 -eq 0) #only show progress every 1000...more frequent progress updates will slow things down
{
Write-Progress -Activity "Processing File $InputPath" -Status "Current Line: $cnt"
}
$splitline = $line.Split('|')
$sw.WriteLine(([string]$splitline[0]).Trim())
}
$sw.Close()