Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Sorting unique values in file using perl

by jwkrahn (Monsignor)
on Oct 24, 2012 at 03:06 UTC ( #1000544=note: print w/ replies, xml ) Need Help??


in reply to Sorting unique values in file using perl

$ echo "gtssmpar11/dmunit1/mt_dm_fifo_csr_flopped_out/u_gt_ram/wrdataR +_reg_0_b171_b174_b236_b242_qreg/d2 19.33 18.65 -0.67 (VIOLAT +ED) gtssmpar11/dmunit1/mt_dm_fifo_csr_flopped_out/u_gt_ram/wrdataR_reg_0_b +186_b196_b210_b223_qreg/d2 15.09 11.70 -3.39 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b103_b104/d2 40.35 36.61 -3.74 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b105_b106/d1 11.06 8.77 -2.29 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b105_b106/d1 40.08 29.18 -10.90 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b119_b120/d2 11.37 8.34 -3.03 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b11_b12/d2 14.56 4.41 -10.15 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b11_b12/d2 45.82 27.47 -18.34 (VIOLATED)" | \ perl -e' my %data; while ( <> ) { my ( $first, undef, undef, $fourth ) = split; if ( !exists $data{ $first } || $data{ $irst }{ fourth } > $fourth + ) { $data{ $first } = { fourth => $fourth, line => $_ }; } } for my $key ( sort keys %data ) { print $data{ $key }{ line }; } ' gtssmpar11/dmunit1/mt_dm_fifo_csr_flopped_out/u_gt_ram/wrdataR_reg_0_b +171_b174_b236_b242_qreg/d2 19.33 18.65 -0.67 (VIOLATED) gtssmpar11/dmunit1/mt_dm_fifo_csr_flopped_out/u_gt_ram/wrdataR_reg_0_b +186_b196_b210_b223_qreg/d2 15.09 11.70 -3.39 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b103_b104/d2 40.35 36.61 -3.74 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b105_b106/d1 40.08 29.18 -10.90 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b119_b120/d2 11.37 8.34 -3.03 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b11_b12/d2 45.82 27.47 -18.34 (VIOLATED)


Comment on Re: Sorting unique values in file using perl
Download Code
Replies are listed 'Best First'.
Re^2: Sorting unique values in file using perl
by PerlSavvy (Initiate) on Oct 24, 2012 at 03:53 UTC

    Hi,

    The code works fine. it is awesome.Thank you so much.

    I got to learn from this code. It is really useful.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000544]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2015-07-28 10:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls