How can I get this sorted by ascending order? (when the number and character is together)
1
0
Entering edit mode
5.4 years ago
woojoy14 ▴ 10
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?

sort • 1.0k views
ADD COMMENT
3
Entering edit mode
5.4 years ago

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.

ADD COMMENT

Login before adding your answer.

Traffic: 1519 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6