从Linux终端输出中提取指定数据

从Linux终端输出中提取指定数据

从 Linux 终端 ( teqc +qc filename) 中的上一个命令,我直接在终端中收到以下输出:

QC of RINEX  file(s) : whcr0010.18o
*********************

4-character ID          : WHCR
Receiver type           : TRIMBLE NETR9 (# = 5240k50059) (fw = 4.85)
Antenna type            : TRM57971.00     NONE (# = 5000113587)

Time of start of window : 2018 Jan  1  00:00:00.000
Time of  end  of window : 2018 Jan  1  23:59:45.000
Time line window length : 24.00 hour(s), ticked every 3.0 hour(s)
Observation interval    : 15.0000 seconds
Total satellites w/ obs : 31
NAVSTAR GPS SVs w/o OBS :  4 
Rx tracking capability  : 44 SVs
Poss. # of obs epochs   :   5760
Epochs w/ observations  :   5590
Epochs repeated         :      0  (0.00%)
Complete observations   :  53001
 Deleted observations   :   2489
Obs w/ SV duplication   :      0  (within non-repeated epochs)
Moving average MP12     : 1.294348 m
Moving average MP21     : 0.700641 m
Points in MP moving avg : 50
Mean S1                 : 44.73 (sd=5.21 n=55490)
Mean S2                 : 31.54 (sd=7.99 n=53001)
No. of Rx clock offsets : 0
Total Rx clock drift    :  0.000000 ms
Rate of Rx clock drift  :  0.000 ms/hr
Avg time between resets : Inf minute(s)
Freq no. and timecode   : 2 13875 ffffff
Report gap > than       : 10.00 minute(s)
       but < than       : 90.00 minute(s)
epochs w/ msec clk slip : 0
other msec mp events    : 0 (: 493)   {expect ~= 1:50}
IOD signifying a slip   : >400.0 cm/minute
IOD slips               :    175
IOD or MP slips         :    222
      first epoch    last epoch    hrs   dt  #expt  #have   %   mp1   mp2 o/slps
SUM 18  1  1 00:00 18  1  1 23:59 23.29  15     -   53001  -   1.29  0.70    239

从这里,我希望提取以下信息:文件名 ( whcr0010.180) 和观察间隔 ( 15.00)。另外,如果我可以将此信息附加到文本文件中,那就太好了。

答案1

以下awk命令应该执行您需要的操作:

teqc +qc filename | awk -F: '$1 ~ "QC of RINEX  file" || $1 ~ "Observation interval" {print $2}' >>output.txt

相关内容