Question: How can I get this sorted by ascending order? (when the number and character is together)
0
gravatar for woojoy14
5 weeks ago by
woojoy140
woojoy140 wrote:
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 • 90 views
ADD COMMENTlink modified 5 weeks ago by Chris Miller21k • written 5 weeks ago by woojoy140
3
gravatar for Chris Miller
5 weeks ago by
Chris Miller21k
Washington University in St. Louis, MO
Chris Miller21k wrote:

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 COMMENTlink written 5 weeks ago by Chris Miller21k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1204 users visited in the last hour