Concatenate csv files with same header

Post date: Mar 21, 2015 12:02:55 AM

I want to merge csv files into one single file by preserving the header of the first one.

> cat file1.csv
Id,city,name ,location
1,NA,JACK,CA
> cat file2.csv
ID,city,name,location
2,NY,JERRY,NY
> cat file3.csv
ID,city,name,location
3,WA,BERNY,WA
> awk 'FNR==1 && NR!=1{next;}{print}' file*.csv > file123.csv
> cat file123.csv
Id,city,name ,location
1,NA,JACK,CA
2,NY,JERRY,NY
3,WA,BERNY,WA

credits: http://stackoverflow.com/questions/16890582/unixmerge-multiple-csv-files-with-same-header-by-keeping-the-header-of-the-firs