3

我得到以下日志:

2013-10-24 18:35:49,728 ERROR [xx.xx.xx.xx.xx.xx] (xx.xx.xx.xx.xx) Manila Olongapo Leyte Tacloban has updated their subscriber details. But, the Regional Account Update interface call has failed for the following Local Registries: <br/>Visayas<br/>Data between LRA and the above Local Registries is out of synch as a result.

我希望结果输入采用以下格式。有什么更好的方法来做到这一点 - 使用awksed可能?请指教。

$Province$ has updated their subscriber details. However, the Customer Account Update interface call has failed for the following Land Registries:
$Region Name$
4

2 回答 2

1

只考虑你的一个例子,只是为了 p̶o̶o̶r̶l̶y̶ 回答你的问题,这里是:

echo '2013-10-24 18:35:49,728 ERROR [xx.xx.xx.xx.xx.xx] (xx.xx.xx.xx.xx) Manila Olongapo Leyte Tacloban has updated their subscriber details. But, the Regional Account Update interface call has failed for the following Local Registries: <br/>Visayas<br/>Data between LRA and the above Local Registries is out of synch as a result.'  | awk '{print $6,$7,$8,$9,$10,$11,$12,$13,$14,"However, the Customer",$18,$19,$20,$21,$22,$23,$24,$25,$26,"Land",$28,substr($29,6,7)}'
于 2014-05-13T17:24:55.703 回答
0

这很容易做到sed

sed -r '
    s#(^.*\) |<br/>Data.*$)##g;
    s/But/However/;
    s/Regional/Customer/;
    s/Local/Land/;
    s# <br/>#\n#
' input.log
Manila Olongapo Leyte Tacloban has updated their subscriber details. However, the Customer Account Update interface call has failed for the following Land Registries:
Visayas
于 2014-04-16T05:42:36.903 回答