How can I get this sorted by ascending order? (when the number and character is together)
samtools view NA12878_dedup.bam | cut -f 3 | sort -u > chr.list8
>
chr1
chr10
chr11
chr12
chr13
chr14
chr15
chr16
chr17
chr18
chr19
chr2
chr20
chr21
chr22
chr3
chr4
chr5
chr6
chr7
chr8
chr9
chrM
chrX
chrY
I run the code above and got this list as chr1 chr10 chr11 .... I would like to get this sorted as chr1 chr2 chr3 ....
Can anyone help me out with this?
• 1,590 views
•
link
1 answer
If you're using GNU sort, then "sort -V" will do what you want.
In general, though, it's not necesary. The community has (somewhat) standardized on character sort order, which is what you have there.
• 0 views
•
link
Log in to answer this question.