运行awk命令时出现太多打开文件错误 [英] Too many open files error while running awk command
本文介绍了运行awk命令时出现太多打开文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试根据模式拆分大文件. 我为此使用awk命令.创建一定数量的文件后,它给出错误:打开的文件太多.
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.
命令是:
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:
awk '/pattern here/{close("file"i); i++}{print > "file"i}' InputFile
这篇关于运行awk命令时出现太多打开文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文