#Exons are already defined in the GTF file, so we simply need to print lines that are marked exonic.
gunzip -c genome_file.gtf.gz |
awk 'BEGIN{OFS="\t";} $3=="exon" {print $1,$4-1,$5}' |
bedtools sort |
bedtools merge -i - | gzip > my_exon.bed.gz