Discussion:
decoding logfile
vwf
2014-07-03 16:02:08 UTC
Permalink
Hello,

I would like to decode a logfile with AIS data. I thought gpsdecode
would be good for this but I have a problem: in de logfile time and I
would like to keep this. My idea was two write a perl-script as a
wrapper, cut off the time, feed the one-line string to gpsdecode, and
write the time with decoded messages to a new file. This does not really
work: gpsdecode alerts about "invalid empty AIS channel. Assuming 'A'".
This wrecks my very simple loop of

while($line = <IN>){
$line=~s/^.*\^EOH\^//;
print WRITEME $line;
$result=<README>;
# and write the result with time
}

I made a much more complex script using use IPC::Open3; use IO::Select;
but that halts after a few thousand lines (I have millions).

Does someone know a ready-to-use trick?

Thanks a lot,
Frits

A short data sample:

^M^M rawtostampedMsg^L 48^UT 1393632002.576^EOH^!AIVDM,1,1,,,139dFkPP000OhBPNPR`P4P440000,0*08
^M^M rawtostampedMsg^L 48^UT 1393632002.582^EOH^!AIVDM,1,1,,,***@P000Oe`4NPI:P4P440000,0*64
^M^M rawtostampedMsg^L 48^UT 1393632002.587^EOH^!AIVDM,1,1,,,139cqN?P000PO9HNWD:04iF40000,0*49
^M^M rawtostampedMsg^L 48^UT 1393632002.587^EOH^!AIVDM,1,1,,,33aIk?BP000PamhNQ9iP4h440000,0*4E
^M^M rawtostampedMsg^L 48^UT 1393632002.603^EOH^!AIVDM,1,1,,,139L4P?P000PsF`NQaGP50440000,0*42
^M^M rawtostampedMsg^L 48^UT 1393632002.607^EOH^!AIVDM,1,1,,,139KTgUP140Pnw`NQ;3RhB840000,0*5E
^M^M rawtostampedMsg^L 48^UT 1393632002.611^EOH^!AIVDM,1,1,,,139LNr?P000PrMlNQDvP50440000,0*08
^M^M rawtostampedMsg^L 48^UT 1393632002.611^EOH^!AIVDM,1,1,,,148O7t0P1>0PqU2NQ6K;2Hb40000,0*3A
^M^M rawtostampedMsg^L 144^UT 1393632002.889^EOH^^^^!AIVDM,1,1,,,1>pf=rgP2608H9>***@40000,0*10
!AIVDM,1,1,,,1>pf9POP1Q08VSVMAdA2:At40000,0*13
!AIVDM,1,1,,,1>pfWawP1g09:InM==8:***@40000,0*1D
^M^M rawtostampedMsg^L 96^UT 1393632002.889^EOH^!AIVDM,1,1,,,1>pfIPOP1U09C6RMBk3RKj<40000,0*1E
!AIVDM,1,1,,,1>pfT;?P1S09U7<MOO88;6h40000,0*57
^M^M rawtostampedMsg^L 48^UT 1393632002.894^EOH^!AIVDM,1,1,,,133tF20P2W0:9DPMG9b3>2j40000,0*44
^M^M rawtostampedMsg^L 48^UT 1393632002.899^EOH^!AIVDM,1,1,,,102:o8wP000:eC4M=fP=wK<40000,0*49
^M^M rawtostampedMsg^L 48^UT 1393632002.905^EOH^!AIVDM,1,1,,,13JVRR0P2F0:@wfNkgjKLq840000,0*64
^M^M rawtostampedMsg^L 48^UT 1393632002.905^EOH^!AIVDM,1,1,,,1>pfI1OP020:n7`M>>lFe9640000,0*11
^M^M rawtostampedMsg^L 48^UT 1393632002.911^EOH^!AIVDM,1,1,,,13ofKV0P1M0;7`FMIFqaWGn40000,0*6F
^M^M rawtostampedMsg^L 96^UT 1393632002.911^EOH^!AIVDM,1,1,,,1>pfVegP000;=5JMEg4uwc>40000,0*03
!AIVDM,1,1,,,1>qc9wOP000:`?VO3EWewK<40000,0*17
^M^M rawtostampedMsg^L 48^UT 1393632002.916^EOH^!AIVDM,1,1,,,15R2wj0P2L0;=9rMS>9iMiF40000,0*5B
^M^M rawtostampedMsg^L 48^UT 1393632002.916^EOH^!AIVDM,1,1,,,1>pfJagP000;L`***@99=wU>40000,0*0D
^M^M rawtostampedMsg^L 48^UT 1393632002.921^EOH^!AIVDM,1,1,,,***@FuhP0a0;B4jO3Lb:WpT40000,0*0A
^M^M rawtostampedMsg^L 48^UT 1393632002.931^EOH^!AIVDM,1,1,,,1>pfaw?P1<0<:dlMAq;B;1r40000,0*7C
^M^M rawtostampedMsg^L 161^UT 1393632002.931^EOH^^^^!AIVDM,2,1,1,,5>pfaw0000000000000PUABn22222222222222000020000Ht00000000000,0*38
!AIVDM,2,2,1,,00000000008,2*6C
!AIVDM,1,1,,,1>pf?dwP080<?`HMK<5t1l640000,0*35
^M^M rawtostampedMsg^L 48^UT 1393632002.938^EOH^!AIVDM,1,1,,,133u@`0P260<KnnMP?:;wIb40000,0*6B
^M^M rawtostampedMsg^L 144^UT 1393632002.938^EOH^^^^!AIVDM,1,1,,,1344Eh3P2M0<K9hMIM4qr`640000,0*5E
!AIVDM,1,1,,,133h`27P0A0<PirMB<N91oB40000,0*51
!AIVDM,1,1,,,13IEVn0P200<8>***@JhP40000,0*05

Continue reading on narkive:
Loading...