当前位置: 技术问答>linux和unix
awk还是用其他能解决我这问题,高手帮忙!
来源: 互联网 发布时间:2017-03-22
本文导语: 本帖最后由 barnin 于 2012-11-09 16:14:36 编辑 qjomp31 TICLI 24> M 49 DUMP:CELL 1 PLM 10 CARRIER: 1 SECTOR: 1 75TH PERCENTILE REVERSE LINK NOISE POWER -83.00dBm -83.00dBm -83.00dBm -83.00dBm -83.00dB...
M 49 DUMP:CELL 1 PLM 10
CARRIER: 1 SECTOR: 1
75TH PERCENTILE REVERSE LINK NOISE POWER
-83.00dBm -83.00dBm -83.00dBm -83.00dBm -83.00dBm -82.00dBm
-82.50dBm -83.00dBm -83.00dBm -83.00dBm -82.75dBm -83.00dBm
-83.00dBm -82.25dBm -83.25dBm -83.25dBm -83.50dBm -83.25dBm
-83.25dBm -83.00dBm -83.25dBm -83.25dBm -83.25dBm -82.50dBm
-82.75dBm -83.00dBm -83.25dBm -83.25dBm -83.00dBm -83.25dBm
-83.50dBm -83.00dBm -82.75dBm -81.75dBm -83.25dBm -83.25dBm
-83.25dBm -83.25dBm -82.50dBm -83.00dBm -83.25dBm -83.00dBm
-83.25dBm -83.25dBm -83.50dBm -83.00dBm -83.25dBm -82.50dBm
-82.75dBm -83.00dBm -82.25dBm -82.75dBm -83.25dBm -82.25dBm
-83.00dBm -83.25dBm -83.25dBm -80.25dBm -82.25dBm -82.75dBm
-83.00dBm -83.00dBm -83.00dBm -82.75dBm -82.75dBm -82.50dBm
-82.75dBm -82.50dBm -82.75dBm -82.75dBm -83.00dBm -83.00dBm
-82.75dBm -83.00dBm -82.25dBm -83.00dBm -83.00dBm -82.50dBm
-82.75dBm -83.00dBm -83.00dBm -83.25dBm -83.50dBm -83.25dBm
-83.50dBm -83.00dBm -83.00dBm -81.00dBm -81.00dBm -80.75dBm
DEVICE - TICLI 24
11/06/12 15:49:54 #569865
qjomp31 TICLI 24>
...........(很多很多行,估计有10万行文件)
希望提取到CELL * sector * -80.75dBM 如图所示:
75TH是判断关键,看到有75TH的才提取NR-2行的CELL *和NR-1行的SECTOE * 和NR+15行的多少dBM,因为有些是没有75TH的。
|
因为你说有10多万行,所以为了提高效率,用了“qjomp31 TICLI 24>”这个分段的标志,如果你的文件这行内容不是固定的,那么就不能用这个过滤条件了。
[nicenight@CSDN ~]$ awk '/qjomp31 TICLI 24>/{getline; if(! match($0, /CELL [^ ]+/)) next; cell = substr($0, RSTART, RLENGTH); getline; if(! match($0, /SECTOR.+/)) next; sector = substr($0, RSTART, RLENGTH); getline; if(! match($0, /75TH/)) next; for(i=0; i