Sample Header Ad - 728x90

How to sort lines by float number

11 votes
1 answer
19935 views
I've such a file: name: xxx --- time: 5.4 seconds name: yyy --- time: 3.2 seconds name: zzz --- time: 6.4 seconds ... Now I want to sort this file by these float numbers to generate a new file as below: name: yyy --- time: 3.2 seconds name: xxx --- time: 5.4 seconds name: zzz --- time: 6.4 seconds ... I've tried the command awk '{print $5}' myfile | sort -g but this will show me ONLY the float numbers.
Asked by Yves (3401 rep)
Jul 30, 2018, 06:02 AM
Last activity: Oct 5, 2022, 10:53 AM