bash sort bed file by chrom start end
# Basic syntax:
sort -V -k1,1 -k2,2 input_file.bed > sorted_file.bed
# This sorts alphanumerically by chromosome and then byvstart position
# and then by end position, producing a file order like:
chr1 1 10
chr1 2 5
chr2 1 10
. . .
. . .
. . .
chr10 1 10
. . .
. . .
. . .
chrX 1 10
chrY 1 10