Mercurial > repos > saskia-hiltemann > file_manipulation
diff sort_chromosomal_position.sh @ 0:e77c9484b2d0 draft default tip
Uploaded
author | saskia-hiltemann |
---|---|
date | Thu, 22 Oct 2015 09:18:30 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sort_chromosomal_position.sh Thu Oct 22 09:18:30 2015 -0400 @@ -0,0 +1,26 @@ +#!/bin/bash + +#sort_chromosomal_position.sh $infile $chrcol $startcol $endcol $num_headerlines + + +cp $1 inputfile.tsv +chrcol=$2 +startcol=$3 +endcol=$4 +num_headerlines=$5 +outfile=$6 + +#remember header +head -$num_headerlines inputfile.tsv > header.tsv + +#remove header +sed -i "1,$num_headerlines d" inputfile.tsv + +#sort file +sort -k ${chrcol},${chrcol}V -k${startcol},${startcol}n inputfile.tsv > tmpout.txt + +cat header.tsv tmpout.txt > $outfile + + + +