Parsing FIX messages for further analytics
Clash 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
text-processing awk
add a comment |Â
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
text-processing awk
awk -F'=' 'gsub(/7225/,""); print $11, $13' file
â jasonwryan
May 28 at 8:14
works perfect....thanks! :)
â Degurube
May 28 at 14:17
add a comment |Â
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
text-processing awk
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
text-processing awk
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
add a comment |Â
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
add a comment |Â
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.
add a comment |Â
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
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
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.
answered May 29 at 0:57
Rakesh Sharma
13513
13513
add a comment |Â
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
Following awk
may help you here.
awk -F"=" 'sub(/[0-9]+/,"",$(NF-4));print $(NF-4),$(NF-2)+0' OFMT="%.05g" Input_file
answered May 29 at 7:15
RavinderSingh13
1235
1235
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
awk -F'=' 'gsub(/7225/,""); print $11, $13' file
â jasonwryan
May 28 at 8:14
works perfect....thanks! :)
â Degurube
May 28 at 14:17