#!/usr/bin/ruby DATA_DIR = File::join(File::dirname(__FILE__), 'rtklib_2.4.2', 'test', 'data', 'rinex') open(File::join(DATA_DIR, '07590920.05n')){|io| line_count = 0 buf = [] io.each{|line| line_count += 1 next if line_count < 13 if (line_count - 13) % 8 == 0 then unless buf.empty? then puts "{#{buf.flatten.join(' ').split(/ +/).reject{|item| item == ''}.join(', ').gsub('D', 'E')}}," end buf = [] end break if line_count >= 205 line.chomp! buf << [line[0..21], line[22..40], line[41..59], line[60..78]] } } puts "-----------------" open(File::join(DATA_DIR, '07590920.05o')){|io| line_count = 0 buf = [] io.each{|line| line_count += 1 next if line_count < 18 break if line_count >= 27 buf << line.chomp! } buf[0] =~ /\d+G/ time_samp = $`.split(/ +/).reject{|item| item == ''} buf[0].scan(/G *\d+/).each_with_index{|v, i| v =~ /\d+/ puts "{#{(time_samp + [$&.to_i] + buf[i + 1].split(/ +/).reject{|item| item == ''}).join(', ')}}," } }