I am trying to split a big file based on a pattern. I am using awk command for this. After creating certain number of files it gives error: Too many open files.
Command is:
awk '/pattern here/{i++}{print > "file"i}' /input file
Can someone tell me how to close these files? I tried following but it gives error.
awk '/pattern here/{i++}{print > "file"i}' /input file | close("file"i)
Before starting on the next file, close the previous one: