在awk中处理每个文件后添加分隔符
我有多个文件,我在两个分隔符之间提取文本(START和END非包含)。在我处理每个文件后,我想输出一个分隔符,指示文件已处理,比如字符串“END”。在每个处理过的文件后,如何将字符串“END”添加到输出中?例如,
假设我有两个包含内容的文件
FILE1.TXT
line 1
line 2
START
I want to extract this text
and this text
END
line 3
line 4
和
FILE2.TXT
line10
line20
START
I also want this text.
END
line 30
我知道如果执行以下操作:
awk '/START/,/END/{if (!/START/&&!/END/) print}' test*.txt
我将得到以下输出:
I want to extract this text
and this text
I also want this text.
但我想要的输出是:
I want to extract this text
and this text
END
I also want this text.
END
在处理完每个文件后,如何将字符串“END”添加到输出中?
没有找到相关结果
已邀请:
3 个回复
公藕
所以你有:
到街客核
貉骂