Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Foreach Output to CSV

$
0
0

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

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles