I have a data file with following lines:
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 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)
And I need to get the unique value and the smallest one for the fourth column with corresponding 1st column.
Output should be:
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
I tried using pattern matching to get the column 1 and column 4 in hash and then sort the hash. But its not working the way i want. Please help.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|