我想按降序排列此文件的絕對值的線性迴歸(p)列。我試圖做到這一點沒有很好的工作。我不知道它失敗了。我發現這個代碼從http://www.unix.com/shell-programming-and-scripting/168144-sort-absolute-value.html。unix中的文件按字段的絕對值排序
awk -F',' '{print ($2>=0)?$2:-$2, $0}' OFS=',' mycsv1.csv | sort -n -k8,8 | cut -d ',' -f2-
X var,Y var,MIC (strength),MIC-p^2 (nonlinearity),MAS (non-monotonicity),MEV (functionality),MCN (complexity),Linear regression (p)
AT1G01030,AT1G32310,0.67958,0.4832027,0.32644996,0.63247,4.0,-0.44314474
AT1G01030,AT3G06520,0.61732,0.17639545,0.23569,0.58557,4.0,0.6640215
AT1G01030,AT5G42580,0.61579,0.5019064,0.30105,0.58143,4.0,0.33746648
AT1G01030,AT1G55280,0.57287,0.20705527,0.19536,0.52857,4.0,0.6048262
AT1G01030,AT5G30490,0.56509,0.37536618,0.16172999,0.51847,4.0,-0.43557298
AT1G01030,AT1G80040,0.56268,0.22935495,0.18583998,0.52728,4.0,-0.5773431
...
請幫我理解awk腳本來對這個文件進行排序。
什麼是「沒有相當的工作「? – pvg
。它沒有按列8或任何其他列排序。所以我不知道它爲什麼失敗 – ChathuraG
仔細看看代碼應該在這裏幫助。我的意思是當你對第8場感興趣時,你爲什麼要在'awk'中尋找'$ 2'字段? – hek2mgl