我得到了以下日志:
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.我希望结果输入采用以下格式。做这件事的更好的方法是什么?- using awk还是sed?请给我建议。
$Province$ has updated their subscriber details. However, the Customer Account Update interface call has failed for the following Land Registries:
$Region Name$发布于 2014-05-14 01:24:56
考虑到你的一行例子,并且只想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-04-16 13:42:37
这在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:
Visayashttps://stackoverflow.com/questions/19967850
复制相似问题