Sort vcf by contig and position within contig Due to tabix constraints, I need to sort a vcf so that contigs and then positions within contigs occur in numerical order in the vcf.  I don't know if the following will sort positions within contigs, but I tried this:

cat in.vcf | vcf-sort -c &gt; out.vcf


but was informed:

Old version of sort command installed, please run without the -c option.


I've read that can cause problems here. Further, my contigs are't numeric, but are something like this: 'Erumb1_s00000030'. 

I see two possible solutions.  (1) I am on Mac OS Mojave, and if there were a way to install the a new unix-style sort, I could use it. I tried homebrew and didn't find anything. (2) there are likely some bash commands that would do it.  If anyone has an idea in either of these directions, I would appreciate it.
You could simply use bcftools sort for it:

$ bcftools sort input.vcf &gt; output.vcf


If you really want to use bash only, you can do this:

$ grep "^#" input.vcf &gt; output.vcf
$ grep -v "^#" input.vcf| sort -k1,1V -k2,2g &gt;&gt; output.vcf


The first command will write the header information to the new vcf file.
The second will sort by contig name and position and append the result to the new vcf file.

fin swimmer