Quote:
Originally Posted by imkornhulio
I used code below (works fine)
split -l 6000 myfile.csv newfile
|
But are you going to continue to use these as .csv files?
You'll notice that a real
.csv file, the first line is a special case. It names the fields for a line.
So after you split your files, do this:
Code:
head -5 second_file_name
That will output the first five lines of your second file. Look very closely at the first line.
Then go to some application which reads the second file. Does it see that first line as data, or does it skip over the first line entirely, or what?
If the first line in the second file is not seen by your application, then you may wish to give more consideration to
adnanm's solution above, even though it seems more complex. It's more complex because it makes sure that your header line appears as the first line of each new file, rather than having a line of data masquerade as a header line, thus not being seen by your application.