import os
os.system("awk '(NR == 1) || (FNR > 1)' file*.csv > merged.csv")
Where NR
and FNR
represent the number of the line being processed.
FNR
is the current line within each file.
NR == 1
includes the first line of the first file (the header), while (FNR > 1) skips the first line of each subsequent file.