さらなる分析のためのFIXメッセージの解析

さらなる分析のためのFIXメッセージの解析

現在の通貨(tag55)と価格(tag133)を示す2つの列を取得するためにFIXメッセージを解析しようとしていますが、メッセージの必須部分が列に分割されていないように見えるため、「awk」を使用するのが困難です。 (太字で表示)参考用です。これを達成する方法についてのアイデアはありますか?

FIX log example:
03:55:16.128 incoming           20180528-07:55:16.015           8587130         11891           8587030         S                  **8=FIX.4.29=013535=S49=IUAT2Feed56=FixServer50=IUAT2Feed_Offers34=858713052=20180528-07:55:16.015117=055=NOK/SEK7225=7133=1.0735135=2100000010=159**
03:55:16.128 incoming           20180528-07:55:16.015           8587131         11891           8587030         S                  **8=FIX.4.29=013435=S49=IUAT2Feed56=FixServer50=IUAT2Feed_Offers34=858713152=20180528-07:55:16.015117=055=USD/CNH7225=2133=6.3872135=300000010=110**

希望の出力:

NOK/SEK 1.0735
USD/CNH 6.3872

ベストアンサー1

  perl -F= -pale '$_ = sprintf "%.7s %.4f", @F[-5,-3]'   fix.log

¶ 仕組み:

 °  split each line as it comes on equal to sign. Store the split values in the array @F

 °  counting from the end of the array @F, the last but 4th  and last but 2nd fields are what we need.

 °  we require the 7 chars and accuracy upto 4 digits.

 °  stuff these in $_ and -p option auto prints it. 

おすすめ記事