Always a great fallback tool when you get ugly flat files. Recently I received 45 500mb flat files. Each one had a 5 lines of headers, with the row names on the fourth line. I used the following to build a single file with a 1 line header:

# Get the row names and put them in a new file called combined.csv
head -4 firstFile.txt | tail -1 > combined.csv

# Get the data from all files and append to combined.csv
# The more complicated 'find, while, do, done' is there because my file names had spaces in
find ./*.txt | while read file; do awk 'NR>5' "$file"; done >> combined.csv

# Finally do a row count reconcilisation
wc -l *.txt && wc -l combined.csv