Foreach Output to CSV

Hi developer,

I have a written a script but i have no idea how to the foreach output loop to csv file.

Script is below:

$regex = .......
$matchInfo = @((Get-Content \.text.txt) -replace '\s+', ' ' |.............)

$output = foreach($minfo in $matchInfo)
{
    foreach($match in @($minfo.Matches | Foreach {$_.Groups[0].value}))
    {
        Write-host -NoNewline "$match,"
    }
    Write-Host ""
}

$output | ???????

I tried this:
$output | Out-File -FilePath Test.csv -Encoding OEM

So i opened the Test.csv and no data. it is empty.

Any Idea?
Thanks


May 20th, 2015 3:45am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics