如果这是一个重复的问题,很抱歉;我对unix很绿色。
我有几个(n = 12)文本文件,其中包含空格的第一列,应全部改为下划线。文件的系统发育ID和计数在不同的样本,见下面的例子。
phylodist all_Tg_3300056613 all_Tg_3300056890 all_Tg_3300057214 all_Tg_3300057270 all_Tg_3300057271
Archaea;Candidatus Diapherotrites;unclassified Candidatus Diapherotrites;unclassified Candidatus Diapherotrites;unclassified Candidatus Diapherotrites;Candidatus Iainarchaeum;Candidatus Iainarchaeum andersonii;Candidatus Iainarchaeum andersonii SCGC AAA011-E11 (contamination screened) 5.91123918323401 12.3266217289478 2.01841255189448 0 0
Archaea;Candidatus Korarchaeota;unclassified Candidatus Korarchaeota;unclassified Candidatus Korarchaeota;unclassified Candidatus Korarchaeota;Candidatus Korarchaeum;Candidatus Korarchaeum cryptofilum;Candidatus Korarchaeum cryptofilum OPF8 419.386679750923 502.442103336035 446.524450581103 0 0
Archaea;Candidatus Micrarchaeota;unclassified Candidatus Micrarchaeota;unclassified Candidatus Micrarchaeota;unclassified Candidatus Micrarchaeota;Candidatus Mancarchaeum;Candidatus Mancarchaeum acidiphilum;Candidatus Mancarchaeum acidiphilum Mia14 7.5272438877384 4.95622132293645 0 0 0
Archaea;Candidatus Thermoplasmatota;Candidatus Poseidoniia;Candidatus Poseidoniales;unclassified Candidatus Poseidoniales;unclassified Candidatus Poseidoniales;uncultured Candidatus Poseidoniales archaeon;Candidatus Poseidoniales archaeon AHCG 5.15021284928401 6.49674226828345 0 0 0
我的目标是将文件作为DESeq 2对象上传到R,中间用“;“。处理所有文件的简单方法是什么?
1条答案
按热度按时间zkure5ic1#
使用
sed
命令:由于替换命令中没有
g
修饰符,因此这将仅用下划线替换每行中的第一个空格。