Reputation: 203
I have two CSV files with the same column structure; A.csv and B.csv
I'm looking for a PowerShell way to append B.csv to the end of A.csv, without the header.
Upvotes: 0
Views: 3449
Reputation: 72612
You can just try:
Import-Csv a.csv, b.csv | Export-Csv c.csv -notype
Upvotes: 1
Reputation: 17462
A variation on @JPBlanc's answer:
$files=@("C:\temp\test\a.csv", "C:\temp20170219\test\b.csv")
import-csv $files | export-csv -NoType "c:\temp\c.csv"
Upvotes: 0
Reputation:
I recommend the answer with Import-Csv | Export-Csv
for simplicity. Just be aware that it's probably not very efficient to parse both (potentially large) files as CSV when that's not really necessary.
This example doesn't make any assumptions about the structure of the files and just takes file 2 (without the first line) and appends it to file 1:
Get-Content .\file2.txt | where ReadCount -gt 1 >> .\file1.txt
Upvotes: 0