I am sorting files which have gene names and their expression values. All files have same exact number of rows ,however after sorting there is a difference in the positioning of certain genes. This is very weird.below are the sorted versions of two such files.
for example:
Cxx1c 25.1695
Cxxc1 15.2228
Cxxc4 0.952061
Cxxc5 3.13309
**Cyb5 157.426**
Cyb561 0.425933
Cyb561a3 9.55082
Cyb561d1 4.00422
Cyb561d2 3.04411
Cyb5b 16.7622
Cyb5d1 7.25191
Cyb5d2 2.85109
Cyb5r1 15.2511
Cyb5r2 0.48748
Another file has this sorting. Basically, in this file Cyb5 is present after Cyb561d2 gene. How can I have exactly same sorting order. Is there any parameter to do such thing?
Cxx1c 44.9795
Cxxc1 19.0346
Cxxc4 1.17429
Cxxc5 2.71589
**Cyb561 7.11003**
Cyb561a3 1.97601
Cyb561d1 2.13004
Cyb561d2 2.03376
Cyb5 64.074
Cyb5b 14.5329
Cyb5d1 12.0212
Cyb5d2 1.47763
Cyb5r1 10.5463
Cyb5r2 0
Here is my code which generates the above sorted file:
for i in *.txt; do
sort -d $i >$i.sort
done
sort -d -k1,1might work-nshould do it