How to sort a file in unix both alphabetically and numerically on different fields?

Try using like this:-

sort -k1,1 -k4,4n
  • -n : Makes the program sort according to numerical value
  • -k opts: Sort data / fields using the given column number. For example, the option -k 2 made the program sort using the second
    column of data. The option -k 3,3n -k 4,4n sorts each column. First
    it will sort 3rd column and then 4th column.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)