我要处理的文件中有大量的task块,需要将该块抓取出来,请各位高人帮忙
cat myfile
--------------
other content
task task_name1
Description
…………………………
endtask
other content
task task_name2
Description
…………………………
endtask
抓取结果为干干净净的task块,如下
task task_name1
Description
…………………………
endtask
task task_name2
Description
…………………………
endtask
如何才能办到,谢谢!
【求助】文本抓取
- susbarbatus
- 帖子: 2966
- 注册时间: 2010-04-10 16:14
- 系统: Arch Linux
-
- 帖子: 40
- 注册时间: 2012-01-28 21:27
Re: 【求助】文本抓取
谢谢!susbarbatus 写了:代码: 全选
sed -n '/task task_name*/,/endtask/p' myfile