Friday 15 July 2011

powershell import-csv two times -



powershell import-csv two times -

this perchance silly question tried import 2 csv-files powershell. when seek write screen first 1 shows.

$connectivitycsvfile = @(import-csv "c:\connectivity.csv") $logfilecsvfile = @(import-csv "c:\1-log.csv") $logfilecsvfile $connectivitycsvfile

print-screen of output

if alter $logfilecsvfile $connectivitycsvfile connectivity-file printed , not logfile

anyone knows why?

i think powershell doing selecting properties show based on types in first collection writing output. sec collection has objects exclusively different properties , values default blanks.

the lines

$logfilecsvfile $connectivitycsvfile

don't show values (at to the lowest degree that's not primary effect). cause script write values output stream. values in stream displayed @ end of command. having output stream 2 different kinds of objects kind of messes default display behavior.

if want output print in table format, should utilize format-table (ft):

$logfilecsvfile | ft $connectivitycsvfile | ft

powershell csv import output

No comments:

Post a Comment