FC_Inter_Fan
FC_Inter_Fan

Reputation: 132

AWK split a large file into thousand mini files error

I have a very large file that I need to split into thousand mini files and this is the error I am getting:

A maximum of 2042 files can be open at one time. The input line number is 144620. The file is help.txt. The source line number is 1.

Here is my code to split the large file:

awk '/HELP./{x="Count"++i;}{print > x;}'  help.txt

Any ideas on how I can get pass this error?

Upvotes: 1

Views: 154

Answers (1)

Håkon Hægland
Håkon Hægland

Reputation: 40778

You should close each file after you are finished with them:

/HELP./{if (x) close (x); x="Count"++i}{print > x}

Upvotes: 5

Related Questions