Input file
9.99331e-13
8.98451e-65
9.98418e-34
7.98319e-08
365592
111669
74942.9
0
Desired output
365592
111669
74942.9
7.98319e-08
1.99331e-13
6.98418e-34
9.98451e-65
0
Command try
sort -nrk1 input_file
365592
111669
74942.9
9.98451e-65
7.98319e-08
6.98418e-34
1.99331e-13
0
Thanks for any advice to get my desired output.
The command I try is fail to get desired output when the input file contain "e"
could this help you ?
#!/usr/bin/perl
@array=<DATA>;
@sorted=sort{$b <=> $a}@array;
print map("$_",@sorted);
__DATA__
9.99331e-13
8.98451e-65
9.98418e-34
7.98319e-08
365592
111669
74942.9
0
1 Like
drl
3
Hi.
Briefly, for input data2:
9.99331e-13
8.98451e-65
9.98418e-34
7.98319e-08
365592
111669
74942.9
0
sort -gr data2
365592
111669
74942.9
7.98319e-08
9.99331e-13
9.98418e-34
8.98451e-65
0
with:
sort (GNU coreutils) 6.10
See man sort for details ... cheers, drl
PS Probably a typo exists in desired output, 1 <- 9 for 9.99331e-13