I have multifasta sequence and i am trying to rename the header and print the first id only 


    >gene_1|id=abc|protein=capA|ABD5672.4
    ATGCGTCGACGTCGTACGGGTTTT
    CGTACGGGTTATGCGTCGACGTCG
    TACGGGTTTT
    
    desired output:

    >gene_1
    ATGCGTCGACGTCGTACGGGTTTT
    CGTACGGGTTATGCGTCGACGTC
    GTACGGGTTTT


  I tried following using sed but didnt work it seems  sed -r 's/^([^|]+\|){0}//;s/\|//'any improvement on    this?       or any other alternative ?

Is this what you want?

`cat gene.fasta | sed 's/|.*//'`

It'll just remove anything after the pipe symbol `|` which separates the field you want from everything else