使用CUT命令或AWK程序从文本文件中删除整列

时间:2013-10-07 16:11:55

标签: awk

我在下面的表格中有一个文本文件。有人可以帮助我如何删除第2,3,4,5,6和7列?我想只保留1,8和9。

 37.55       6.00      24.98       0.00      -2.80      -3.90   26.675  './gold_soln_CB_FragLib_Controls_m1_9.mol2'                    'ethyl'
 38.45       1.39      27.36       0.00      -0.56      -2.48   22.724  './gold_soln_CB_FragLib_Controls_m2_6.mol2'  'pyridin-2-yl(pyridin-3-yl)methanone'
 38.47       0.00      28.44       0.00      -0.64      -2.42   20.387  './gold_soln_CB_FragLib_Controls_m3_3.mol2'  'pyridin-2-yl(pyridin-4-yl)methanone'
 42.49       0.07      30.87       0.00      -0.03      -3.24   22.903  './gold_soln_CB_FragLib_Controls_m4_5.mol2'  '(3-chlorophenyl)(pyridin-3-yl)methanone'
 38.20       1.47      27.53       0.00      -1.13      -3.28   22.858  './gold_soln_CB_FragLib_Controls_m5_2.mol2'  'dipyridin-4-ylmethanone'
 41.87       0.57      30.53       0.00      -0.67      -3.16   22.829  './gold_soln_CB_FragLib_Controls_m6_9.mol2'  '(3-chlorophenyl)(pyridin-4-yl)methanone'
 38.18       1.49      27.09       0.00      -0.56      -1.63    7.782  './gold_soln_CB_FragLib_Controls_m7_1.mol2'  '3-hydrazino-6-phenylpyridazine'
 39.45       1.50      27.71       0.00      -0.15      -4.17   17.130  './gold_soln_CB_FragLib_Controls_m8_6.mol2'  '3-hydrazino-6-phenylpyridazine'
 41.54       4.10      27.71       0.00      -0.65      -4.44    9.702  './gold_soln_CB_FragLib_Controls_m9_4.mol2'  '3-hydrazino-6-phenylpyridazine'
 41.05       1.08      29.30       0.00      -0.31      -2.44   28.590  './gold_soln_CB_FragLib_Controls_m10_3.mol2'  '3-hydrazino-6-(4-methylphenyl)pyridazine'

1 个答案:

答案 0 :(得分:3)

尝试:

awk '{print $1"\t"$8"\t"$9}' yourfile.tsv > only189.tsv