给定这个输入文件:
SectionMarker and some random text here
this is the text in section 1
this is the text in section 1
this is the text in section 1
etc
SectionMarker and some random text here also
this is the text in section 2
this is the text in section 2
this is the text in section 2
etc
SectionMarker and some random text too
this is the text in section 3
this is the text in section 3
this is the text in section 3
etc
如何使用 awk 或 sed 或其他方法将此文件拆分为几部分?
这是我尝试过的,但没有奏效:
awk -vRS='\SectionMarker[:print:]\n' 'NR==1 {print}' ./data.log