我希望使用sed捕获重复组以解析日志行
this.SizeChanged += (s,e) =>
{
//reset all changed properties to default value here
...
//some condition you want to use to distinguish landscape and portrait
if ( Width < Height )
{
//set properties for portrait
}
}
我希望只捕获以下字段
echo "14:14:52.449 [thread] INFO LOGGER - SYMBOL: FIELD1[1.0] FIELD2[2] FIELD3[141452 (2016-11-24 14:14:52.000)] FIELD4[4]" | sed -E "s/(\d\d:\d\d:\d\d.\d\d\d )(.*?\-)( .*?\:)(.*)( FIELD3\[.*?\]).*/\\1\\3\\5/"
然而,我得到整条线。非常感谢任何帮助
14:14:52.449 SYMBOL FIELD3[141452 (2016-11-24 14:14:52.000)]
答案 0 :(得分:0)
使用sed:
sed -E "s/^(([0-9]{2}:){2}[0-9]{2}\.[0-9]{3}).*( [^:]*):.*( FIELD3\[[^]]*\]).*/\1\3\4/"