Thanks for your reply, sorry if I didn't explain well, the issue is that I have 334 sequences that are under a single fasta file. Each sequence on their fasta headers (starting with '>') have information about the sequence's gene identity. That information is given by the GN section but it appears at almost the end of the sequence.
What I need is that the gene information appears just after the first pipe sign on each one of the 334 fasta headers.
check if this works:
Replace sed with gsed on MacOS.