我有这样的文件:
1 17 A G R:560:500:60:10.71%:1.6329E-19 Pass:1.0:276:0:57:0:1E0 15 17 0 0 R:24:20:4:16.67%:5.461E-2 R:22:20:2:9.09%:2.4419E-1 R:27:24:3:11.11%:1.1792E-1 R:26:23:3:11.54%:1.1765E-1 A:16:16:0:0%:1E0 A:23:23:0:0%:1E0 A:11:10:1:9.09%:5E-1
1 36 C T Y:560:499:61:10.89%:7.7026E-20 Pass:1.0:275:0:58:0:1E0 15 17 0 0 Y:24:20:4:16.67%:5.461E-2 Y:22:20:2:9.09%:2.4419E-1 Y:27:24:3:11.11%:1.1792E-1 Y:26:23:3:11.54%:1.1765E-1 C:16:16:0:0%:1E0 C:23:23:0:0%:1E0 C:11:10:1:9.09%:5E-1
我以前一直在使用下面的 awk on liner 从 $11 开始提取每个字段的第一个字符。
awk '{n=11; while (n<18) {{$n = substr($n, 0, 1)} n++} print $0}'
我正在寻找一种简单的方法来修改它,以便我只能从这些字段中提取百分比(字段第 4 个冒号之后的值)。输出将如下所示:
1 17 A G R:560:500:60:10.71%:1.6329E-19 Pass:1.0:276:0:57:0:1E0 15 17 0 0 16.67% 9.09% 11.11% 11.54% 0% 0% 9.09%
1 36 C T Y:560:499:61:10.89%:7.7026E-20 Pass:1.0:275:0:58:0:1E0 15 17 0 0 16.67% 9.09% 11.11% 11.54% 0% 0% 9.09%
干杯。