How to get pipe (|) delimiters between FIX tags in a UNIX command for FIX logs?
Asked Answered
G

1

6

I am able to get spaces between tags by running:

tail -f filename | tr '\001' ' '

but I would like the tail output to have | delimiters, i.e.

35=D|49=sender|56=recipient

anyone know how? thanks

Germainegerman answered 2/12, 2015 at 16:29 Comment(2)
Please format your post with adapted markdownServomechanical
I fixed your question's formatting.Parkway
P
10

Don't you simply want this?

tail -f filename | tr '\001' '|'
                              ^
                              replace space with pipe!

\001 is ASCII character 1, also known as SOH ("start of heading"). FIX uses this character as the field separator, i.e. it follows every "tag=value" element.

The unix tr command simply replaces all instances of the first parameter (\001 above) with the second parameter (|).

Parkway answered 2/12, 2015 at 19:49 Comment(7)
what does \001 represent?Germainegerman
It's ASCII character 1 aka the SOH character. I've added more to my answer to explain this.Parkway
Thank you again Grant, that is a really clear explanationGermainegerman
No problem. If your question is resolved, please "accept" this answer so that SO will mark it as resolved.Parkway
I have found that when using this, if i add a grep afterwards or before it tends to kind stop the tail from working as expected. It sort of splutters or doesnt update at all, for example: tail -f filename | tr '\001' '|' | grep abcGermainegerman
any ideas or thoughts on that?Germainegerman
Sorry, no, I don't have any insight into that.Parkway

© 2022 - 2024 — McMap. All rights reserved.