I have a log file which is very dense
You cant see them, but there is a 'CTRL-A' character before each "numeric tag='. The escape character for the CTRL-A is '0001'
Code:
casper@casper-SX280:~$ more dense_file | head -1
>8=FIX.4.29=027835=834=11605249=NQPX56=S085H652=20120217-14:35:31.191128=S15BX257=6T0050=INET11=6T0010005924641=6T0010005924537=92392017=-11185520=0150=539=5109=MLCO55=NTAP54=538=20032=031=0.0151=20014=06=0.044=42.780040=247=A29=176=INET111=018=N59=558=Replaced10=085
casper@casper-SX280:~$
anyhow I can sed them out with 's/\x01/ /g' - look at those nice spaces in the dense_log !!!
Code:
casper@casper-SX280:~$ more dense_file | sed -e 's/\x01/ /g' | head -1
> 8=FIX.4.2 9=0278 35=8 34=116052 49=NQPX 56=S085H6 52=20120217-14:35:31.191 128=S15BX2 57=6T00 50=INET 11=6T00100059246 41=6T00100059245 37=923920 17=-111855 20=0 150=5 39=5 109=MLCO 55=NTAP 54=5 38=200 32=0 31=0.0 151=200 14=0 6=0.0 44=42.7800 40=2 47=A 29=1 76=INET 111=0 18=N 59=5 58=Replaced 10=085
So I wanted to write something up in perl - this works
Code:
#!/usr/bin/perl
use strict ;
open (FILE , "dense_file") or die "cannot open up the file";
while (<FILE>) {
s/\x01/ /g;
print $_;
sleep 1;
}
However when I assign a variable to the default varible $_ it stops working.
Code:
#!/usr/bin/perl
use strict ;
open (FILE , "dense_file") or die "cannot open up the file";
while (<FILE>) {
my $line = $_;
s/\x01/ /g;
print $line;
sleep 1;
}