Tag Archives: LIT

How to output selective delimited data to a new file?

By Buddyluv

I have the following file which at times can be quite large so can be difficult to read, I need a script that just extracts particular delimited data and outputs to alternate file

Code:


$cat fix1.log

FIX4.4 |0=12|55=LIT.L|48=123456|32=5|52=20111107-10:52:22.128|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|32=15|52=20111107-10:52:22.128|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|32=115|52=20111107-10:52:22.133|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|32=500|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|32=2|38=100|10=200|110=233
FIX4.4 |0=12|55=LIT.L|48=123456|32=5|38=100|10=200|110=221
FIX4.4 |0=12|55=LIT.L|48=123456|32=5|38=100|10=200|775=1
FIX4.4 |0=12|55=LIT.L|48=123456||35=1|34=52|32=2|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|35=0|32=5|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|35=5|32=4|38=100|10=200|


So for example if I was only interested in the data within delimiters 0= *, 32=* & 52=* I would want the output to look like this :

Code:

|0=12 |32=5 |52=20111107-10:52:22.128
|0=12 |32=2 |52=20111107-10:52:23.133
|0=12 |32=11 |52=20111107-10:52:22.145
|0=12 |32=55 |52=20111107-10:52:24.128
|0=12 |32=5 |52=20111107-10:53:22.128


Then if perhaps I wanted to manipulate this output further and calculate the sum values of column 32=

Assistance appreciated !!

From: http://www.unix.com/shell-programming-scripting/221111-how-output-selective-delimited-data-new-file.html

Extracting Delimiter 'TAG' Data From log files

By Buddyluv

Hi
I am trying to extract data from within a log file and output format to a new file for further manipulation can someone provide script to do this?

For example I have a file as below and just want to extract all delimited variances of tag 32=* up to the delimiter “|” and output to a new file so that I can calculate the total of these values.

$cat fix1.log

FIX4.4 |0=12|55=LIT.L|48=123456|32=5|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|32=15|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|32=115|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|32=500|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|32=2|38=100|10=200|110=233
FIX4.4 |0=12|55=LIT.L|48=123456|32=5|38=100|10=200|110=221
FIX4.4 |0=12|55=LIT.L|48=123456|32=5|38=100|10=200|775=1
FIX4.4 |0=12|55=LIT.L|48=123456||35=1|34=52|32=2|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|35=0|32=5|38=100|10=200|
FIX4.4 |0=12|55=LIT.L|48=123456|35=5|32=4|38=100|10=200|

As you can see the delimited tag 32 is not always in the same position within the file and ideally I would like the output to consist of just the individual numeric values after the 32=

5
15
115
500
etc etc

Assistance appreciated

Buddy

From: http://www.unix.com/shell-programming-scripting/220949-extracting-delimiter-tag-data-log-files.html