I have the data look like this
$ cat file
(71149, 3079, 68070, 0.0433) Alex
(51135, 2881, 48254, 0.0563) Brandon
(27231, 7105, 20126, 0.2609) Chad
(8365, 3634, 4731, 0.4344) Daniel
(7490, 7346, 144, 0.9808) Eliz
(6841, 3917, 2924, 0.5726) Frank
(6740, 7393, -653, 1.0969) Gates
(5084, 500, 4584, 0.0983) Harry
(5044, 3913, 1131, 0.7758) Ian
(4760, 699, 4061, 0.1468) Jack
....
I want to sort the content by the last element in the bracket, how can i do it in command line.
$ cat file | ... magic ...
(6740, 7393, -653, 1.0969) Gates
(7490, 7346, 144, 0.9808) Eliz
(5044, 3913, 1131, 0.7758) Ian
(6841, 3917, 2924, 0.5726) Frank
(8365, 3634, 4731, 0.4344) Daniel
(27231, 7105, 20126, 0.2609) Chad
(4760, 699, 4061, 0.1468) Jack
(5084, 500, 4584, 0.0983) Harry
(51135, 2881, 48254, 0.0563) Brandon
(71149, 3079, 68070, 0.0433) Alex
....
I succeeded in sorting the number but I don't know how to print the whole line in awk.
$cat file | sed 's/)//g' | awk 'BEGIN{FS=" "}{print $4}' | sort -r
5.1246
4.3936
2.7811
2.5
1.9
....