001、
[root@PC1 test]# ls a.fa [root@PC1 test]# cat a.fa ## 测试fasta文件 >chr1 AACCCTTG TTCCCCC >chr2 CCCTTTTT CCCCCCCC TTTT >chr3 TTTTCCCC GGGG [root@PC1 test]# awk '{if(NR == 1) {print $0} else if($0 !~ />/) {printf("%s", $0)} else {printf("\n"); print $0}} END {printf("\n")}' a.fa ## 将每条scaffold的碱基转换为1行 >chr1 AACCCTTGTTCCCCC >chr2 CCCTTTTTCCCCCCCCTTTT >chr3 TTTTCCCCGGGG [root@PC1 test]# awk '{if(NR == 1) {print $0} else if($0 !~ />/) {printf("%s", $0)} else {printf("\n"); print $0}} END {printf("\n")}' a.fa | cat -A >chr1$ AACCCTTGTTCCCCC$ >chr2$ CCCTTTTTCCCCCCCCTTTT$ >chr3$ TTTTCCCCGGGG$
标签:shell,fa,scaffold,linux,else,test,printf,print,PC1 From: https://www.cnblogs.com/liujiaxin2018/p/17041580.html