samedi 29 novembre 2014

Merging CSV files without loosing the header line


I need to merge two CSV files datasorted1.csv datasorted2.csv, but my hearders keep getting sorted. This is the cmd I'm using: head -n 1 datasorted1.csv datasorted2.csv > resultado.csv && tail -n +2 datasorted1.csv datasorted2.csv | sort -t "|" -k 1 >> resultado.csv


Sample data: Name|Email|Country|Company|Phone Brent Trujillo|tempus@mauris.org|Burkina Faso|Donec LLC|(612) 943-0167



Aucun commentaire:

Enregistrer un commentaire