Merge two csvs

I have two CSV files which share one column called database in common. I am looking to merge both CSVs into one. Here is a summary of what I am looking for.

file1.csv

Database Size freespace
DB1 100 50
DB2 80 55
DB3 90 40

File2.csv

Database MBXCount WhiteSpace
DB1 20 50
DB2 100 2
DB3 50 9

Desired file
MergedFile.csv

Database Size freespace MBXCount WhiteSpace
DB1 100 50 20 50
DB2 80 55 100 2
DB3 90 40 50 9

Any help would be appreciated.

The PowerShell team made a blog post on this a couple years ago: Join-Object. As long as your set size is not too huge, it works great. (It doesn’t scale well; very slow when you’re trying to merge thousands of records.)

Thanks for the feedback. I actually went with merge-csv function. It did what I was looking for.

http://www.powershelladmin.com/wiki/An_Advanced_Cmdlet_to_Merge_Csv_Files_in_PowerShell