Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to split a large csv file in unix command line

Tags:

unix

printf

awk

I am just splitting a very large csv file in to parts. When ever i run the following command. the doesn't completely split rather returns me the following error. how can i avoid the split the whole file.

       awk -F, '{print > $2}' test1.csv 

       awk: YY1 makes too many open files
       input record number 31608, file test1.csv
       source line number 1
like image 709
user2498657 Avatar asked Oct 28 '13 19:10

user2498657


1 Answers

Just close the files after writing:

awk -F, '{print > $2; close($2)}' test1.csv
like image 82
Chris Seymour Avatar answered Oct 14 '22 00:10

Chris Seymour