split file and insert a text at the beginning of a file

 I have a text file. the first line constans of the titles.

and i have an one large file which has over 70,000 lines.

and some of the line, has a test cases.


to test programs in a big file, it took over 10minutes.


$cat file.csv

"title"||"title2"||"title3"

"data"||"data2"||"data3"

......


$wc -l file.csv 

77488 file.csv


#split it by lines

$split -l 10,000 file.csv myfile

$ls myfile*

myfileaa myfileab myfileac myfilead myfileae myfileaf myfileag myfileah

$cat myfileaa > myfile_01

$head -1 myfileaa | cat - myfileab > myfile_02

$head -1 myfileaa | cat - myfileac > myfile_03

$head -1 myfileaa | cat - myfilead > myfile_04

$head -1 myfileaa | cat - myfileae > myfile_05

$head -1 myfileaa | cat - myfileaf > myfile_06

$head -1 myfileaa | cat - myfileag > myfile_07



댓글