How to remove the header in fasta file and keep only the desirable part on ubuntu?

How to remove the header in fasta file and keep only the desirable part on ubuntu?

2

Hi all,

I have a fasta file with this header

>10005_M12.fastq    Otu0001|242290|M1.fastq-M12.fastq-M5.fastq-URTM6.fastq-M7.fastq-M9.fastq

I want to remove all the header parts except the OTU (with its number),
I used the this command “sed ‘s/>M.Otu/>Otu/g’ rep.fasta |sed -e ‘s/|.//g’> rep.otu.fasta”
but the command removed only the part after OTU as following;

>10005_M12.fastq    Otu0001

I want the header looks like (>Otu0001)

any advices will be appreciated
Thank you


microbiome


bioinformatics


fasta


NGS

• 338 views

updated 1 hour ago by

17k

written 15 hours ago by

0

Read more here: Source link