Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Discarding records with duplicate fields Post 303043654 by RavinderSingh13 on Monday 3rd of February 2020 06:26:37 AM
Old 02-03-2020
Hello beca123456,

Could you please try following.

Code:
awk '/^grp1/{print;a[$2,$4,$5,$6,$7]++;next} !a[$2,$4,$5,$6,$7]++'   Input_file

Output will be as follows.

Code:
grp1    name2   firstname       M       55      item1   item1.0
grp1    name2   firstname       F       55      item1   item1.0
grp2    name1   firstname       M       55      item1   item1.0

Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Records Duplicate

Hi Everyone, I have a flat file of 1000 unique records like following : For eg Andy,Flower,201-987-0000,12/23/01 Andrew,Smith,101-387-3400,11/12/01 Ani,Ross,401-757-8640,10/4/01 Rich,Finny,245-308-0000,2/27/06 Craig,Ford,842-094-8740,1/3/04 . . . . . . Now I want to duplicate... (9 Replies)
Discussion started by: ganesh123
9 Replies

2. Shell Programming and Scripting

compare fields in a file with duplicate records

Hi: I've been searching the net but didnt find a clue. I have a file in which, for some records, some fields coincide. I want to compare one (or more) of the dissimilar fields and retain the one record that fulfills a certain condition. For example, on this file: 99 TR 1991 5 06 ... (1 Reply)
Discussion started by: rleal
1 Replies

3. Shell Programming and Scripting

combine duplicate records

I have a .DAT file like below 23666483030000653-B94030001OLFXXX000000120081227 23797049900000654-E71060001OLFXXX000000220081227 23699281320000655 E71060002OLFXXX000000320081227 22885068900000652 B86860003OLFXXX592123320081227 22885068900000652 B86860003ODL-SP592123420081227... (8 Replies)
Discussion started by: kshuser
8 Replies

4. UNIX for Dummies Questions & Answers

Getting non-duplicate records

Hi, I have a file with these records abc xyz xyz pqr uvw cde cde In my o/p file , I want all the non duplicate rows to be shown. o/p abc pqr uvw Any suggestions how to do this? Thanks for the help. rs (2 Replies)
Discussion started by: rs123
2 Replies

5. UNIX for Dummies Questions & Answers

Need to keep duplicate records

Consider my input is 10 10 20 then, uniq -u will give 20 and uniq -dwill return 10. But i need the output as , 10 10 How we can achieve this? Thanks (4 Replies)
Discussion started by: pandeesh
4 Replies

6. Shell Programming and Scripting

Find duplicate based on 'n' fields and mark the duplicate as 'D'

Hi, In a file, I have to mark duplicate records as 'D' and the latest record alone as 'C'. In the below file, I have to identify if duplicate records are there or not based on Man_ID, Man_DT, Ship_ID and I have to mark the record with latest Ship_DT as "C" and other as "D" (I have to create... (7 Replies)
Discussion started by: machomaddy
7 Replies

7. Shell Programming and Scripting

Deleting duplicate records from file 1 if records from file 2 match

I have 2 files "File 1" is delimited by ";" and "File 2" is delimited by "|". File 1 below (3 record shown): Doc1;03/01/2012;New York;6 Main Street;Mr. Smith 1;Mr. Jones Doc2;03/01/2012;Syracuse;876 Broadway;John Davis;Barbara Lull Doc3;03/01/2012;Buffalo;779 Old Windy Road;Charles... (2 Replies)
Discussion started by: vestport
2 Replies

8. Shell Programming and Scripting

Remove duplicate records

Hi, i am working on a script that would remove records or lines in a flat file. The only difference in the file is the "NOT NULL" word. Please see below example of the input file. INPUT FILE:> CREATE a ( TRIAL_CLIENT NOT NULL VARCHAR2(60), TRIAL_FUND NOT NULL... (3 Replies)
Discussion started by: reignangel2003
3 Replies

9. Shell Programming and Scripting

Duplicate records

Gents, I have a file which contends duplicate records in column 1, but the values in column 2 are different. 3099753489 3 3099753489 5 3101954341 12 3101954341 14 3102153285 3 3102153285 5 3102153297 3 3102153297 5 I will like to get something like this: output desired... (16 Replies)
Discussion started by: jiam912
16 Replies

10. Shell Programming and Scripting

Duplicate records

Gents, Please give a help file --BAD STATUS NOT RESHOOTED-- *** VP 41255/51341 in sw 2973 *** VP 41679/51521 in sw 2973 *** VP 41687/51653 in sw 2973 *** VP 41719/51629 in sw 2976 --BAD COG NOT RESHOOTED-- *** VP 41689/51497 in sw 2974 *** VP 41699/51677 in sw 2974 *** VP... (18 Replies)
Discussion started by: jiam912
18 Replies
UI::Dialog::Backend::KDialog(3pm)			User Contributed Perl Documentation			 UI::Dialog::Backend::KDialog(3pm)

NAME
UI::Dialog::Backend::KDialog SYNOPSIS
use UI::Dialog::Backend::KDialog; my $d = new UI::Dialog::Backend::KDialog ( backtitle => 'Demo', title => 'Default' ); $d->msgbox( title => 'Welcome!', text => 'Welcome one and all!' ); ABSTRACT
UI::Dialog::Backend::KDialog is the UI::Dialog backend for the KDE dialog variant. While this module is used through UI::Dialog or any other loader module only the compatible methods are ever accessible. However, when using this module directly in your application (as in the SYNOPSIS example) you are given access to all the options and features of the real kdialog(1) application. DESCRIPTION
Although this dialog variant doesn't have any progress meters, it does have the benefits of many different file/uri/directory widgets. It's a shame that this is the only dialog variant for KDE. EXPORT
None INHERITS
UI::Dialog::Backend CONSTRUCTOR
new( @options ) EXAMPLE my $d = new( title => 'Default Title', backtitle => 'Backtitle', width => 65, height => 20, listheight => 5 ); DESCRIPTION This is the Class Constructor method. It accepts a list of key => value pairs and uses them as the defaults when interacting with the various widgets. RETURNS A blessed object reference of the UI::Dialog::Backend::KDialog class. OPTIONS The (...)'s after each option indicate the default for the option. An * denotes support by all the widget methods on a per-use policy defaulting to the values decided during object creation. debug = 0,1,2(0) literal = 0,1(0) backtitle = "backtitle" ('') * title = "title" ('') * nocancel = 0,1(0) * defaultno = 0,1(0) * beepbefore = 0,1(0) * beepafter = 0,1(0) * extrabutton = 0,1(0) * extralabel = "extra label" (0) * helpbutton = 0,1(0) * helplabel = "help label" (0) * maxinput = d+(0) * WIDGET METHODS
yesno( ) yesnocancel( ) warningyesno( ) warningyesnocancel( ) EXAMPLE # if ($d->warningyesnocancel( text => 'A question?') ) { # if ($d->warningyesno( text => 'A question?') ) { # if ($d->yesnocancel( text => 'A question?') ) { if ($d->yesno( text => 'A binary type question?') ) { # user pressed yes } else { # user pressed no or cancel } DESCRIPTION Present the end user with a message box that has two buttons, yes and no. RETURNS TRUE(1) for a response of YES or FALSE(0) for anything else. msgbox( ) EXAMPLE $d->msgbox( text => 'A simple message' ); DESCRIPTION Pesent the end user with a message box that has an OK button. RETURNS TRUE(1) for a response of OK or FALSE(0) for anything else. password( ) EXAMPLE my $string = $d->password( text => 'Enter some (hidden) text.' ); DESCRIPTION Present the end user with a text input field that doesn't reveal the input (except to the script) and a message. RETURNS a SCALAR if the response is OK and FALSE(0) for anything else. inputbox( ) EXAMPLE my $string = $d->inputbox( text => 'Enter some text.', entry => 'this is the input field' ); DESCRIPTION Present the end user with a text input field and a message. RETURNS a SCALAR if the response is OK and FALSE(0) for anything else. textbox( ) EXAMPLE $d->textbox( path => '/path/to/a/text/file' ); DESCRIPTION Present the end user with a simple scrolling box containing the contents of the given text file. RETURNS TRUE(1) if the response is OK and FALSE(0) for anything else. menu( ) EXAMPLE my $selection1 = $d->menu( text => 'Select one:', list => [ 'tag1', 'item1', 'tag2', 'item2', 'tag3', 'item3' ] ); DESCRIPTION Present the user with a selectable list. RETURNS a SCALAR of the chosen tag if the response is OK and FALSE(0) for anything else. checklist( ) EXAMPLE my @selection = $d->checklist( text => 'Select one:', list => [ 'tag1', [ 'item1', 0 ], 'tag2', [ 'item2', 1 ], 'tag3', [ 'item3', 1 ] ] ); DESCRIPTION Present the user with a selectable checklist. RETURNS an ARRAY of the chosen tags if the response is OK and FALSE(0) for anything else. radiolist( ) EXAMPLE my $selection = $d->radiolist( text => 'Select one:', list => [ 'tag1', [ 'item1', 0 ], 'tag2', [ 'item2', 1 ], 'tag3', [ 'item3', 0 ] ] ); DESCRIPTION Present the user with a selectable radiolist. RETURNS a SCALAR of the chosen tag if the response is OK and FALSE(0) for anything else. fselect( ) getopenfilename( ) getsavefilename( ) getopenurl( ) getsaveurl( ) EXAMPLE # my $text = $d->getsaveurl( path => '/path/' ); # my $text = $d->getopenurl( path => '/path/' ); # my $text = $d->getsavefilename( path => '/path/' ); # my $text = $d->getopenfilename( path => '/path/' ); my $text = $d->fselect( path => '/path/to/a/file/or/directory' ); DESCRIPTION Present the user with a file selection widget preset with the given path. RETURNS a SCALAR if the response is OK and FALSE(0) for anything else. dselect( ) getexistingdirectory( ) EXAMPLE # my $text = $d->getexistingdirectory( path => '/path/to/a/dir' ); my $text = $d->dselect( path => '/path/to/a/directory' ); DESCRIPTION Present the user with a file selection widget preset with the given path. Unlike fselect() this widget will only return a direc- tory selection. RETURNS a SCALAR if the response is OK and FALSE(0) for anything else. SEE ALSO
PERLDOC UI::Dialog UI::Dialog::KDE UI::Dialog::Backend UI::Dialog::Backend::XOSD MAN FILES None. Use `kdialog --help` from a command line. BUGS
Please email the author with any bug reports. Include the name of the module in the subject line. AUTHOR
Kevin C. Krinke, <kckrinke@opendoorsoftware.com> COPYRIGHT AND LICENSE
Copyright (C) 2003 Kevin C. Krinke <kckrinke@opendoorsoftware.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA perl v5.8.8 2004-08-01 UI::Dialog::Backend::KDialog(3pm)
All times are GMT -4. The time now is 05:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy