作者roy8130 (reputation)
看板perl
标题[问题] print 特定段落
时间Tue Aug 14 08:25:21 2007
假设我的档案内容test.txt
test.txt ----> 输出结果
sage 1
1 1
2 2
3 3
sage 2
4 4
5 5
6 6
sage 3
7 7
8 8
sage 4
. .
. .
. .
假如我我想抓出所有在 /sage\s\d+/ 之间的所有段落
请问该如何写? 谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.216.113.156
1F:→ abreaction:print unless /sage\s\d+$\//; 08/14 10:29
2F:→ abreaction:修正:while (<>) {print unless /sage\s\d+/;} 08/14 10:37
3F:推 abreaction:上面是全印,还是只要如sage1-2间"特定段落"值1,2,3 08/14 10:43