Via BEDOPS `convert2bed` (`psl2bed`) and `bedops` operations: $ psl2bed < hits.psl | bedops --range 5 --everything - > answer.bed The file `answer.bed` will contain intervals from the PSL input, padded up- and downstream by five bases. This BED file can be run through `samtools faidx` or [similar][1] to get sequence data. [1]: https://bioinformatics.stackexchange.com/a/5374/776