我有一个日志格式如下使用sed匹配多个线条图案
<<
[ABC] some other data
some other data
>>
<<
DEF some other data
some other data
>>
<<
[ABC] some other data
some other data
>>
我想要的选择,它们是具有ABC预期的结果的所有日志是
<<
[ABC] some other data
some other data
>>
<<
[ABC] some other data
some other data
>>
什么会为sed命令的表达? 对于获取内容的B/W < < >>表达将
sed -e '/<</,/>>/!d'
但我怎么能强迫它有[ABC]中的B/W
第二个表达式带来了一切。 – 2012-03-26 10:49:02
不,它会在符合'/^<< \ n \ [ABC \]/p'的范围内打印那些行,以及完全在范围外的任何行。在这种情况下,“/^<,/^>> /' – potong 2012-03-26 11:38:18
N.B. '/^<< \ n \ [ABC \]/p'可以缩写为'/ ABC/p' – potong 2012-03-26 11:45:01