Parsing FIX messages for further analytics

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I'm currently trying to parse my FIX messages to get 2 columns showing currency (tag55) and price (tag133) but having difficulty using 'awk' as it appears the desired part of the message isn't split into columns (in bold for your reference). Any thoughts on how to accomplish this?



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**


Desired output:



NOK/SEK 1.0735
USD/CNH 6.3872






share|improve this question





















  • awk -F'=' 'gsub(/7225/,""); print $11, $13' file
    – jasonwryan
    May 28 at 8:14










  • works perfect....thanks! :)
    – Degurube
    May 28 at 14:17














up vote
2
down vote

favorite












I'm currently trying to parse my FIX messages to get 2 columns showing currency (tag55) and price (tag133) but having difficulty using 'awk' as it appears the desired part of the message isn't split into columns (in bold for your reference). Any thoughts on how to accomplish this?



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**


Desired output:



NOK/SEK 1.0735
USD/CNH 6.3872






share|improve this question





















  • awk -F'=' 'gsub(/7225/,""); print $11, $13' file
    – jasonwryan
    May 28 at 8:14










  • works perfect....thanks! :)
    – Degurube
    May 28 at 14:17












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I'm currently trying to parse my FIX messages to get 2 columns showing currency (tag55) and price (tag133) but having difficulty using 'awk' as it appears the desired part of the message isn't split into columns (in bold for your reference). Any thoughts on how to accomplish this?



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**


Desired output:



NOK/SEK 1.0735
USD/CNH 6.3872






share|improve this question













I'm currently trying to parse my FIX messages to get 2 columns showing currency (tag55) and price (tag133) but having difficulty using 'awk' as it appears the desired part of the message isn't split into columns (in bold for your reference). Any thoughts on how to accomplish this?



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**


Desired output:



NOK/SEK 1.0735
USD/CNH 6.3872








share|improve this question












share|improve this question




share|improve this question








edited May 28 at 8:10









jasonwryan

46.5k14126174




46.5k14126174









asked May 28 at 8:09









Degurube

111




111











  • awk -F'=' 'gsub(/7225/,""); print $11, $13' file
    – jasonwryan
    May 28 at 8:14










  • works perfect....thanks! :)
    – Degurube
    May 28 at 14:17
















  • awk -F'=' 'gsub(/7225/,""); print $11, $13' file
    – jasonwryan
    May 28 at 8:14










  • works perfect....thanks! :)
    – Degurube
    May 28 at 14:17















awk -F'=' 'gsub(/7225/,""); print $11, $13' file
– jasonwryan
May 28 at 8:14




awk -F'=' 'gsub(/7225/,""); print $11, $13' file
– jasonwryan
May 28 at 8:14












works perfect....thanks! :)
– Degurube
May 28 at 14:17




works perfect....thanks! :)
– Degurube
May 28 at 14:17










2 Answers
2






active

oldest

votes

















up vote
0
down vote













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


¶ how it works :



 ° 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.





share|improve this answer




























    up vote
    0
    down vote













    Following awk may help you here.



    awk -F"=" 'sub(/[0-9]+/,"",$(NF-4));print $(NF-4),$(NF-2)+0' OFMT="%.05g" Input_file





    share|improve this answer





















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );








       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446436%2fparsing-fix-messages-for-further-analytics%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote













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


      ¶ how it works :



       ° 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.





      share|improve this answer

























        up vote
        0
        down vote













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


        ¶ how it works :



         ° 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.





        share|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









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


          ¶ how it works :



           ° 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.





          share|improve this answer













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


          ¶ how it works :



           ° 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.






          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered May 29 at 0:57









          Rakesh Sharma

          13513




          13513






















              up vote
              0
              down vote













              Following awk may help you here.



              awk -F"=" 'sub(/[0-9]+/,"",$(NF-4));print $(NF-4),$(NF-2)+0' OFMT="%.05g" Input_file





              share|improve this answer

























                up vote
                0
                down vote













                Following awk may help you here.



                awk -F"=" 'sub(/[0-9]+/,"",$(NF-4));print $(NF-4),$(NF-2)+0' OFMT="%.05g" Input_file





                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Following awk may help you here.



                  awk -F"=" 'sub(/[0-9]+/,"",$(NF-4));print $(NF-4),$(NF-2)+0' OFMT="%.05g" Input_file





                  share|improve this answer













                  Following awk may help you here.



                  awk -F"=" 'sub(/[0-9]+/,"",$(NF-4));print $(NF-4),$(NF-2)+0' OFMT="%.05g" Input_file






                  share|improve this answer













                  share|improve this answer



                  share|improve this answer











                  answered May 29 at 7:15









                  RavinderSingh13

                  1235




                  1235






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446436%2fparsing-fix-messages-for-further-analytics%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Displaying single band from multi-band raster using QGIS

                      How many registers does an x86_64 CPU actually have?