sort a Set

Q: How to sort an instance of java.util.Set?


See a more detailed explanation here.

sort/ order data table by comlumn

sort GTF

(grep "^#" file.gtf; grep -v "^#" file.gtf | sort -k1,1 -k4,4n) > file_sorted.gtf
will first write all comments (lines beginning with #) tofile_sorted.gtf, then all other lines sorted first by the first column, alphanumerically, second by the fourth column, numerically. This works as well for files that do not contain comments. Sort compressed:
(zgrep "^#" file.gtf; zgrep -v "^#" file.gtf | sort -k1,1 -k4,4n) | gzip > file_sorted.gtf.gz