Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Combining Multiple CSV Files with Powershell

$
0
0

Hi,

I have a number of CSV files that I want to combine into a single CSV file. They all have the same number of rows and one of the files has 2 columns.(i.e. a timestamp row and a numerical value that is associated with each timestamp) and all of the rest have a single column (a numerical value that is associated with the relevant timestamp in the first column of the first row but for a different system). I need the output file to have multiple columns e.g. if there is a single two-column file, as described, and 4 single-column files, the output file would have six columns with each of the single columns from the 4 single-column files being placed progressively to the right of the two-column file to allow information for the relevant timestamp for each of the 4 additional systems (as well as the original) to be viewed and ultimately graphed.

I have been trawling through the web and Powershell utilities such as import-csv, export-csv, get-content etc etc to figure out how I can do this but without success. I need the final output file that results from the combination to be in a format such that when I use if as the input to import-csv, the first row will be in a format such that each component of the first row will be a heading for the imported CSV file ... but I think this should happen by default anyway. Any ideas on this?

Thanks,

alan_the_geek.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>