2014-04-01 57 views
0

我有個製表符分隔的文件,其具有20列和40行與在linux某些字段去除線

missense 
nonsense 
5' UTR 
3' UTR 

所以它們在柱9和我請求專用線與某些值保持在我的輸出,但執行此當我得到什麼輸出 因此,如果值是錯義或無義保留那些行,否則刪除它們

awk -F"\t" '$9 == "missense" || $9 == "nonsense" ' input > output 

我也曾嘗試

awk -F"\t" '$9 == "missense"' || ' $9 == "nonsense" ' input > output 

所有答案都是0字節。

+1

你的第一行應該工作,你的'$ 9'有前/後空格?嘗試'打印$ 9'看看你是否檢查正確的列。 – Kent

回答

0

考慮使用匹配,而不是平等的:

awk -F"\t" '$9 ~ "missense" || $9 ~ "nonsense" ' input > output 

,如果你想「這-錯義太」從輸出省略了,但在其他方面避免問題這是不是一個好的選擇與領先或尾隨空格等

0

看起來你的文件有空格和標籤。試試這個:

awk -F'[[:space:]]+' '$9 == "missense" || $9 == "nonsense"' input > output