R
R
RazorBlade2016-03-11 09:59:45
PowerShell
RazorBlade, 2016-03-11 09:59:45

How to summarize variable values ​​in a table in Powershell?

Good day everyone!
As a result of parsing a bunch of files, there are several variables that contain lines with data that all need to be summarized in one table, you can in csv.

$A
abc
zxc
$B
qwe
asd
$C
123
456

Everything needs to look like this:
A        B        C 
abc     qwe    123 
zxc     asd     456

Messed around with the design
$tabName = “SampleTable” 

#Create Table object 
$table = New-Object system.Data.DataTable “$tabName” 

#Define Columns 
$col1 = New-Object system.Data.DataColumn A,([string]) 
$col2 = New-Object system.Data.DataColumn B,([string]) 
$col3 = New-Object system.Data.DataColumn С,([string]) 

#Add the Columns 
$table.columns.add($col1) 
$table.columns.add($col2) 
$table.columns.add($col3) 

#Create a row 
$row = $table.NewRow()

but I don’t understand how to push the data from my variables there.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
azarij, 2016-03-11
@azarij

and it is obligatory to do?
you can see the script in which you get the variables that you want to put in the table?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question