View Single Post
Old 01-02-2009   #2 (permalink)
Kryten


 
 

Re: output multiple arrays to file

Hi Justin,

This assumes that your arrays all contain the same number of elements.

$a = 1..10 ; $b = 11..20 ; $c = 21..30
foreach ( $i in (0..$a.count) ) {
Add-Content -path "arraytest.txt" `
-value "$($a[$i])`r`n$($b[$i])`r`n$($c[$i])"
}

Just one way though, bet there are dozens of other|better ways.

Cheers,
Stuart
My System SpecsSystem Spec