001、测试数据
[root@pc1 test2]# ls a.fa [root@pc1 test2]# cat a.fa ## 测试数据 >chr1 ddtttggggg eeeeee >chr2 iiiiirrrr sssssssss >chr3 uuuuueeeee qqqqqqqqq >chr4 tttttttt wwwwwww >chr5 yyyyyyy ggggggg
002、sed命令实现提取任意的scaffold数据:
提取scaffold1
[root@pc1 test2]# cat a.fa >chr1 ddtttggggg eeeeee >chr2 iiiiirrrr sssssssss >chr3 uuuuueeeee qqqqqqqqq >chr4 tttttttt wwwwwww >chr5 yyyyyyy ggggggg [root@pc1 test2]# sed -n '/^>chr1/,/^>/p' a.fa | sed '1b; />/d' ## 提取scaffold1 >chr1 ddtttggggg eeeeee
003、提取scaffold3
[root@pc1 test2]# ls a.fa [root@pc1 test2]# cat a.fa ## 测试数据 >chr1 ddtttggggg eeeeee >chr2 iiiiirrrr sssssssss >chr3 uuuuueeeee qqqqqqqqq >chr4 tttttttt wwwwwww >chr5 yyyyyyy ggggggg [root@pc1 test2]# sed -n '/^>chr3/,/^>/p' a.fa | sed '1b; />/d' ## 提取scaffold3 >chr3 uuuuueeeee qqqqqqqqq
004、提取scaffold5
[root@pc1 test2]# ls a.fa [root@pc1 test2]# cat a.fa ## 测试数据 >chr1 ddtttggggg eeeeee >chr2 iiiiirrrr sssssssss >chr3 uuuuueeeee qqqqqqqqq >chr4 tttttttt wwwwwww >chr5 yyyyyyy ggggggg [root@pc1 test2]# sed -n '/^>chr5/,/^>/p' a.fa | sed '1b; /^>/d' ## 提取scaffold5 >chr5 yyyyyyy ggggggg
标签:test2,sed,##,scaffold,pc1,fa,shell,linux,root From: https://www.cnblogs.com/liujiaxin2018/p/17000685.html