Skip to content

Instantly share code, notes, and snippets.

@moshemal
Last active June 25, 2017 13:26
Show Gist options
  • Save moshemal/696692a671fdf85595df40fa0307cdfa to your computer and use it in GitHub Desktop.
Save moshemal/696692a671fdf85595df40fa0307cdfa to your computer and use it in GitHub Desktop.
concat csv files into one file
#!/bin/bash
dataPath=$1
outFilePath=$2
files=(`ls ${dataPath}`)
#write the column names
head -n 1 ${dataPath}/${files[0]} > ${outFilePath}
#concat all data
for file in ${files[*]}
do
tail -n +2 ${dataPath}/${file} >> ${outFilePath}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment