sort through text file numerically by numbers in column

26 views Asked by At

i have the following text file:

product whole gi 664313980 , location int { from 1990 , to 2895 , strand minus
product whole gi 664591270 , location int { from 567 , to 1319 , strand minus
product whole gi 664591271 , location int { from 1368 , to 1976 , strand minus
product whole gi 664591272 , location int { from 3032 , to 3574 , strand minus
product whole gi 664591273 , location int { from 3631 , to 4062 , strand minus
product whole gi 664591274 , location int { from 6285 , to 7448 , strand minus
product whole gi 664591275 , location int { from 7445 , to 8353 , strand minus
product whole gi 664591277 , location int { from 8350 , to 9108 , strand minus
product whole gi 664591278 , location int { from 9327 , to 11525 
product whole gi 664591280 , location int { from 11697 , to 13364 
product whole gi 664591282 , location int { from 13505 , to 14065 , strand minus
product whole gi 664591283 , location int { from 14131 , to 16107 , strand minus
product whole gi 664591285 , location int { from 16276 , to 17493 , strand minus
product whole gi 664591286 , location int { from 17490 , to 18056 , strand minus
product whole gi 664591288 , location int { from 18226 , to 18957 
product whole gi 664591290 , location int { from 19138 , to 19584 , strand minus
product whole gi 664591293 , location int { from 19646 , to 22066 
product whole gi 664591298 , location int { from 25742 , to 28477 , strand minus
product whole gi 664591299 , location int { from 28998 , to 29885 , strand minus
product whole gi 664591300 , location int { from 29882 , to 30883 , strand minus
product whole gi 664591301 , location int { from 30883 , to 32172 , strand minus
product whole gi 664591302 , location int { from 0 , to 368 , strand minus
product whole gi 739968934 , location int { from 24075 , to 25430 
product whole gi 739968936 , location int { from 25352 , to 25648 
product whole gi 739968938 , location int { from 4059 , to 4259 , strand minus
product whole gi 739968940 , location int { from 22250 , to 23854 

and i want to sort it by the numbers after "from" and before the ","

i've tried using the sort linux command however i have not had much success.

any one know how to go about this? thanks

1

There are 1 answers

0
Brent Washburne On

Try using sort -n -k10 <file>