How to get the genomic sequences from a blat result?
Via BEDOPS convert2bed (psl2bed) and bedops operations:
$ psl2bed &lt; hits.psl | bedops --range 5 --everything - &gt; answer.bed

The file answer.bed will contain target intervals from the PSL (BLAT) input, padded up- and downstream by five bases.
This BED file can be run through samtools faidx or similar to get sequence data.
References:

https://bedops.readthedocs.io/en/latest/content/reference/file-management/conversion/psl2bed.html

https://bedops.readthedocs.io/en/latest/content/reference/set-operations/bedops.html#range-range