fasta file truncates headers

When converting fastq files to fasta, seems to only choose the first space-delimited text in the header. Like this:

@MISEQ:7:000000000-AMAKG:1:1101:16998:1719 1:N:0:PE716:ST6_21 TTGACCCT|0|TAGACCTA|0 ST6_21_F|0|23|



But those other fields are critical for my analysis (they identify the sample number, origin of sample, primers, and gene). Is there a way to get the whole header?

You would have to write a script to connect the two. You could generate a mapping file doing…

grep “^@” *fastq | cut -c 2- > headers.txt