Linux Tip: SORT of linux

If you want to sort a tab limited file in ascending order according to one column (like 5th column), you can use:
sort -k5,5n input
However, if you want to sort the file in descending order ccording to one column (like 5th column), you cann't use:
sort -r -k5,5n input 
You can use:
sort -r n-k5,5 input 

 -n, --numeric-sort
          compare according to string numerical value
-r, --reverse
         reverse the result of comparisons

Comments

Popular posts from this blog

gspread error:gspread.exceptions.SpreadsheetNotFound

Miniconda installation problem: concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

转载:彻底搞清楚promoter, exon, intron, and UTR