简体   繁体   English

运行 awk 命令时打开的文件太多错误

[英]Too many open files error while running awk command

I am trying to split a big file based on a pattern.我正在尝试根据模式拆分一个大文件。 I am using awk command for this.我为此使用了 awk 命令。 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)

在开始下一个文件之前,请关闭上一个文件:

    awk '/pattern here/{close("file"i); i++}{print > "file"i}' InputFile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM