Welcome to the Genome Toolbox! I am glad you navigated to the blog and hope you find the contents useful and insightful for your genomic needs. If you find any of the entries particularly helpful, be sure to click the +1 button on the bottom of the post and share with your colleagues. Your input is encouraged, so if you have comments or are aware of more efficient tools not included in a post, I would love to hear from you. Enjoy your time browsing through the Toolbox.

Wednesday, May 29, 2013

Unix Sort by Column Number

I always forget the flags to use when using UNIX sort.  Here is a list of common useful flags.

Flags
-k: selects the column number to sort
-n: indicates you are sorting numeric values so use numeric ordering (ex: 10, 11, not 10, 100)
-r: sort in reverse (descending) order for this column

An example line of code that sorts by numeric values in column 2 in descending order would be as follows.

No comments:

Post a Comment