Sponsored Content
Top Forums Shell Programming and Scripting squeeze duplicates from a table Post 302423929 by Alex_P on Sunday 23rd of May 2010 01:35:41 PM
Old 05-23-2010
squeeze duplicates from a table

I have files with an x amounts of rows with each row having 2 columns seperated by delimiter "|" .
File contains following records for example.

Code:
15|69
15|70
15|71
15|72
15|73
15|74
16|2
16|3
16|4
16|5
16|6
16|7
16|8
16|9
16|10
16|11
16|12
16|13
16|14
16|15
16|16
16|17
16|18
16|19
16|20
16|21
17|2
17|3
19|2
19|3

I want to be able to format this table so that it only shows the rows whith the largest corresponding column numbers.

for example, using the example above, I want the command to return:

Code:
15|74
16|21
17|3
19|3



Is there anyway to return the largest column number ($2) with it's corresponding row ($1) using awk?

Appreciate help.

Last edited by vgersh99; 05-23-2010 at 02:49 PM.. Reason: code tags, please!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

TR squeeze oddity

I discovered that where 'tr -s' works as expected on grepped input, it appears to completely fail on dig results. I am not sure if this is because of some sort of non posix compliancy, or what. Here is what I did: The command below works as expected, squeezing all repeated spaces to a single... (3 Replies)
Discussion started by: bdmeyersc
3 Replies

2. Shell Programming and Scripting

Merge Two Tables with duplicates in first table

Hi.. File 1: 1 aa rep 1 dd rep 1 kk rep 2 bb sad 2 ss sad 3 ee dam File 2 1 apple fruit 2 mango tree 3 lilly flower output: 1 aaple fruit aa,dd,kk rep (7 Replies)
Discussion started by: empyrean
7 Replies

3. UNIX for Advanced & Expert Users

Load average in squeeze too low

sorry, not yelling, its just copied from a bug report and this prob is driving me crazy... ran stress --cpu 4 on a xeon and no problem the load went up to 4, but running mysql server for example the load is almost 0.00, where the same mysql server with same throughput gets 0.8 on another lenny... (15 Replies)
Discussion started by: suffeks
15 Replies

4. UNIX Desktop Questions & Answers

How to squeeze multiple pipe character '|' into single '|' using sed?

Hi, I am trying to convert multiple Unix pipe symbol or bar into single |. I have tried with the following sed statements, but, no success :(. I need it using sed only echo "sed 's/\|\+/\|/g' sed 's/*/\|/' sed 's/\|*/|/' sed -r 's/\|+/\|/' However, the below awk code is working fine.... (4 Replies)
Discussion started by: royalibrahim
4 Replies

5. UNIX for Dummies Questions & Answers

Creating a condensed table from a pre-existing table in putty

Hello, I'm working with putty on Windows 7 professional and I'd like to know if there's a way to gather specific lines from a pre-existing table and make a new table with that information. More specifically, I'd like the program to look at a specific column, say column N, and see if any of the... (5 Replies)
Discussion started by: Deedee393
5 Replies

6. Shell Programming and Scripting

Help me please: UNIX command to extract substring not squeeze spaces

Hi experts, Please help me!... I have a string " test1 test2 test3 ". There are two spaces before "test1"; There are four spaces between "test1" and "test2"; there are two spaces between "test2 and "test3". I want to extract a substring "2 test3" using positions. Below is my test... (5 Replies)
Discussion started by: sophiez16
5 Replies

7. Debian

VPN service fails after update applied in Debian Squeeze

Hello everybody, I used to log in to my office via PPTP VPN, but on last October 5th I updated my installed Debian Squeeze and it caused my VPN service (client-side) to fail. After this upgrade I'm unable to log in to the VPN server. Here follows the log: #tail -f /var/log/messages Plugin... (0 Replies)
Discussion started by: r4ym4r
0 Replies

8. Shell Programming and Scripting

Filtering duplicates based on lookup table and rules

please help solving the following. I have access to redhat linux cluster having 32gigs of ram. I have duplicate ids for variable names, in the file 1,2 are duplicates;3,4 and 5 are duplicates;6 and 7 are duplicates. My objective is to use only the first occurrence of these duplicates. Lookup... (4 Replies)
Discussion started by: ritakadm
4 Replies

9. Web Development

Getting Rid of Annoying Bootstrap Table Borders and Wayward Table Lines

Bootstrap is great; but we have had some issues with Bootstrapped <tables> (and legacy <fieldset> elements) showing annoying, wayward lines. I solved that problem today with this simple jQuery in the footer: <script> $(function(){ $('tr, td, fieldset,... (0 Replies)
Discussion started by: Neo
0 Replies

10. UNIX for Beginners Questions & Answers

Remove duplicates in a dataframe (table) keeping all the different cells of just one of the columns

Hello all, I need to filter a dataframe composed of several columns of data to remove the duplicates according to one of the columns. I did it with pandas. In the main time, I need that the last column that contains all different data ( not redundant) is conserved in the output like this: A ... (5 Replies)
Discussion started by: pedro88
5 Replies
Gtk2::Table(3pm)					User Contributed Perl Documentation					  Gtk2::Table(3pm)

NAME
Gtk2::Table - wrapper for GtkTable HIERARCHY
Glib::Object +----Glib::InitiallyUnowned +----Gtk2::Object +----Gtk2::Widget +----Gtk2::Container +----Gtk2::Table INTERFACES
Glib::Object::_Unregistered::AtkImplementorIface Gtk2::Buildable METHODS
widget = Gtk2::Table->new ($rows, $columns, $homogeneous=FALSE) o $rows (integer) o $columns (integer) o $homogeneous (boolean) $table->attach ($child, $left_attach, $right_attach, $top_attach, $bottom_attach, $xoptions, $yoptions, $xpadding, $ypadding) o $child (Gtk2::Widget) o $left_attach (integer) o $right_attach (integer) o $top_attach (integer) o $bottom_attach (integer) o $xoptions (Gtk2::AttachOptions) o $yoptions (Gtk2::AttachOptions) o $xpadding (integer) o $ypadding (integer) $table->attach_defaults ($widget, $left_attach, $right_attach, $top_attach, $bottom_attach) o $widget (Gtk2::Widget) o $left_attach (integer) o $right_attach (integer) o $top_attach (integer) o $bottom_attach (integer) integer = $table->get_col_spacing ($column) o $column (integer) $table->set_col_spacing ($column, $spacing) o $column (integer) o $spacing (integer) $table->set_col_spacings ($spacing) o $spacing (integer) integer = $table->get_default_col_spacing integer = $table->get_default_row_spacing boolean = $table->get_homogeneous $table->set_homogeneous ($homogeneous) o $homogeneous (boolean) $table->resize ($rows, $columns) o $rows (integer) o $columns (integer) integer = $table->get_row_spacing ($row) o $row (integer) $table->set_row_spacing ($row, $spacing) o $row (integer) o $spacing (integer) $table->set_row_spacings ($spacing) o $spacing (integer) (rows, columns) = $table->get_size Since: gtk+ 2.22 PROPERTIES
'column-spacing' (Glib::UInt : default 0 : readable / writable / private) The amount of space between two consecutive columns 'homogeneous' (boolean : default false : readable / writable / private) If TRUE, the table cells are all the same width/height 'n-columns' (Glib::UInt : default 1 : readable / writable / private) The number of columns in the table 'n-rows' (Glib::UInt : default 1 : readable / writable / private) The number of rows in the table 'row-spacing' (Glib::UInt : default 0 : readable / writable / private) The amount of space between two consecutive rows CHILD PROPERTIES
'bottom-attach' (Glib::UInt : default 1 : readable / writable / private) The row number to attach the bottom of the child to 'left-attach' (Glib::UInt : default 0 : readable / writable / private) The column number to attach the left side of the child to 'right-attach' (Glib::UInt : default 1 : readable / writable / private) The column number to attach the right side of a child widget to 'top-attach' (Glib::UInt : default 0 : readable / writable / private) The row number to attach the top of a child widget to 'x-options' (Gtk2::AttachOptions : default expand,fill : readable / writable / private) Options specifying the horizontal behaviour of the child 'x-padding' (Glib::UInt : default 0 : readable / writable / private) Extra space to put between the child and its left and right neighbors, in pixels 'y-options' (Gtk2::AttachOptions : default expand,fill : readable / writable / private) Options specifying the vertical behaviour of the child 'y-padding' (Glib::UInt : default 0 : readable / writable / private) Extra space to put between the child and its upper and lower neighbors, in pixels ENUMS AND FLAGS
flags Gtk2::AttachOptions o 'expand' / 'GTK_EXPAND' o 'shrink' / 'GTK_SHRINK' o 'fill' / 'GTK_FILL' SEE ALSO
Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.14.2 2012-05-27 Gtk2::Table(3pm)
All times are GMT -4. The time now is 03:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy