Script for extracting continues data
Hello...
I have continues sequence of data in type
clk = 0.016 +- 0.018
trp = 2.271 +0.043 +- 0.001
amb G29 = 2.924 +- 0.012 nEpo = 4093
amb G06 = 4.995 +- 0.014 nEpo = 3524
amb G03 = -1.386 +- 0.015 nEpo = 848
amb G21 = -0.403 +- 0.013 nEpo = 481
amb G18 = -4.100 +- 0.013 nEpo = 377
amb G22 = 9.674 +- 0.013 nEpo = 216
amb G16 = -1.265 +- 0.016 nEpo = 5
12-05-30 21:14:26 VSAK_PAM PPP 21:14:25.0 7 4640364.248 +- 0.014 2205651.817 +- 0.011 3767241.543 +- 0.011 NEU 0.075 -0.107 -0.078
into a text file and i want to extract the time 21:14:26 and data after NEU into a new file in type like
{
"label": "VSAK_PAM_N",
"data": [[211426, 0.075], etc]
},
{ "label": "VSAK_PAM_E",
"data": [[211426,-0.107], etc]
},
{ "label": "VSAK_PAM_U",
"data": [[211426,-0.078], etc]
}
also continues doing this until the file ends.
Thanks
What? What language is this? :-) What is the relationship of the first lines (amb ...) with the line below (12-05-30 ...)?
If you just want to extract the time (with colons stripped), and save the label and data, given the latter line, in Perl, you could say:
Code:
my $line = '12-05-30 21:14:26 VSAK_PAM PPP 21:14:25.0 7 4640364.248 +- 0.014 2205651.817 +- 0.011 3767241.543 +- 0.011 NEU 0.075 -0.107 -0.078';
my ($time, $label, $data) = $line =~ /\d\d-\d\d-\d\d (\d\d:\d\d:\d\d) (\S+) .*? NEU (.+)/;
$time =~ s/://g;
my @data = split /\s+/, $data;
print record('N', $data[0], $time, $label);
print record('E', $data[1], $time, $label);
print record('U', $data[2], $time, $label);
sub record {
my ($suffix, $data_piece, $time, $label) = @_;
return <<"EODATA";
{
"label": "${label}_$suffix",
"data": [[$time, $data_piece], etc]
}
EODATA
}
I just want to extract the data nothing else its not a programming language just a text file.
Thanks for your answer i will try it and gine you a feedback
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks