Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Awk 如何从一个文件中筛选不同的文件_Awk - Fatal编程技术网

Awk 如何从一个文件中筛选不同的文件

Awk 如何从一个文件中筛选不同的文件,awk,Awk,比如说,从“进程”开始到下一个“进程”,我需要不同的文件。 例如 输入文件 Process=0 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. Process=1 We prefer questions th

比如说,从“进程”开始到下一个“进程”,我需要不同的文件。 例如 输入文件

Process=0 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. Process=1 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. Process=2 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. 进程=0 我们更喜欢可以回答的问题,而不仅仅是讨论。 提供细节。写得清楚简单。 如果你的问题是关于这个网站的,可以在meta上提问。 进程=1 我们更喜欢可以回答的问题,而不仅仅是讨论。 提供细节。写得清楚简单。 如果你的问题是关于这个网站的,可以在meta上提问。 过程=2 我们更喜欢可以回答的问题,而不仅仅是讨论。 提供细节。写得清楚简单。 如果你的问题是关于这个网站的,可以在meta上提问。 预期产量 文件0应包含

Process=0 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. Process=1 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. Process=2 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. 进程=0 我们更喜欢可以回答的问题,而不仅仅是讨论。 提供细节。写得清楚简单。 如果你的问题是关于这个网站的,可以在meta上提问。 文件_1应包含

Process=0 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. Process=1 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. Process=2 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. 进程=1 我们更喜欢可以回答的问题,而不仅仅是讨论。 提供细节。写得清楚简单。 如果你的问题是关于这个网站的,可以在meta上提问。 文件2应包含

Process=0 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. Process=1 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. Process=2 We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply. If your question is about this website, ask it on meta instead. 过程=2 我们更喜欢可以回答的问题,而不仅仅是讨论。 提供细节。写得清楚简单。 如果你的问题是关于这个网站的,可以在meta上提问。 查看Linux中的命令。它在分隔符处拆分文本文件(可能由正则表达式定义)。

查看Linux中的命令。它在分隔符处拆分文本文件(可能由正则表达式定义)。

使用gawk/nawk(Solaris)

使用gawk/nawk(Solaris)


这将为每个部分创建文件并将文本输出到它们。如果在第一个“进程”之前有文本,则将其放入名为“序言”的文件中


这将为每个部分创建文件并将文本输出到它们。如果在第一个“进程”之前有文本,则将其放入名为“序言”的文件中


FS的使用很好。它可以重写为:
awk-F'[=]”开始{file=“Preamble”}$1==“Process”{file=“file”{2}{print>>文件}输入文件
FS的使用很好。它可以重写为:
awk-F'[=]”开始{file=“Preamble”}$1==“Process file”{file=“file”{file=“file”{2}{print>>文件}输入文件