0
votes

I have n number of csv files that I will need to concatenate. The issue is I need to remove the header file from each one.

I have tried using these tail -n +2 $INPUT_FILE_PATH/$FILE > $NEW_INPUT_FILE_PATH

***This puts the filename and path in the newfile

==> /file path/filename1.csv <==

A, B, C, D 
E, F, G, H

==> /file path/filename2.csv <==

I, J, K, L 
M, N, O, P

I have tried

sed 1d $INPUT_FILE_PATH/$FILE > $NEW_INPUT_FILE_PATH

***Only removes the header from the first file.

A, B, C, D,
E, F, G, H

Header1, header2, header3, header4

I, J, K, L
M, N, O, P

How can I have the result be

A, B, C, D,
E, F, G, H
I, J, K, L
M, N, O, P
2

2 Answers

0
votes

You can use find and sed for that:

 find /path/to/files -name '*.csv' -exec sed '1d' {} \;
0
votes
awk 'FNR>1' file1 file2 ...