Debian Codegraph @

scripts/vcfsort.sh

raw
1 #!/bin/bash
2
3 [ $# -eq 0 ] && { echo "Sorts a VCF file in natural chromosome order";\
4 echo "Usage: $0 [my.vcf | my.vcf.gz]"; exit 1;
5 }
6 if LC_ALL=C (zless $1 | grep ^#; zless $1 | grep -v ^# | sort -k1,1V -k2,2n);
7 then
8 exit 0
9 else
10 printf 'sort failed. Does your version of sort support the -V option?\n'
11 printf 'If not, you should update sort with the latest from GNU coreutils:\n'
12 printf 'git clone git://git.sv.gnu.org/coreutils'
13 fi