【发布时间】:2020-07-11 06:34:03
【问题描述】:
我有一个包含以下模式行的文件。
date=2020-02-22 time=13:32:41 type=text subtype=text ip=1.2.3.4 country="China" service="foo" id=47291 msg="foo: bar.baz," value=50
date=2020-03-17 time=11:49:54 type=text subtype=anothertext ip=1.2.3.5 country="Russian Federation" service="bar" id=47324 msg="foo: bar.baz," value=30
date=2020-03-30 time=16:29:24 type=text subtype=someothertext ip=1.2.3.6 country="Korea, Republic of" service="grault, garply" id=47448 msg="foo: bar.baz," value=60
我想删除类型、子类型和服务以及这些字段的值(= 之后的值)。
期望的输出:
date=2020-02-22 time=13:32:41 ip=1.2.3.4 country="China" id=47291 msg="foo: bar.baz," value=50
date=2020-03-17 time=11:49:54 ip=1.2.3.5 country="Russian Federation" id=47324 msg="foo: bar.baz," value=30
date=2020-03-30 time=16:29:24 ip=1.2.3.6 country="Korea, Republic of" id=47448 msg="foo: bar.baz," value=60
在知之甚少的情况下,我一直在尝试使用cut、awk、sed,但仍然没有接近解决方案。我已经在网上搜索了几个小时,但这也徒劳无功。有人可以帮忙吗?
【问题讨论】: