Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 497
Jamie Avatar asked Dec 02 '15 16:12

Jamie


People also ask

How do you pipe a command in Unix?

You can make it do so by using the pipe character '|'. Pipe is used to combine two or more commands, and in this, the output of one command acts as input to another command, and this command's output may act as input to the next command and so on.

What is Soh in FIX message?

in a FIX message are terminated by a delimiter character. The non-printing, ASCII "SOH" (#001, hex: 0x01, referred to in this document as <SOH>), is used for field termination. Messages are delimited by the “SOH” character following the Checksum field.

What is pipe symbol in Unix?

One of the most powerful shell operators is the pipe ( | ). The pipe takes output from one command and uses it as input for another. And, you're not limited to a single piped command—you can stack them as many times as you like, or until you run out of output or file descriptors.

What is the use of pipe in shell script?

The pipe character | is used to connect the output from one command to the input of another. > is used to redirect standard output to a file. Try it in the shell-lesson-data/exercise-data/proteins directory!


1 Answers

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 (|).

like image 138
Grant Birchmeier Avatar answered Sep 29 '22 14:09

Grant Birchmeier