Sponsored Content
Top Forums Shell Programming and Scripting finding duplicates in columns and removing lines Post 302189018 by totus on Thursday 24th of April 2008 06:05:12 PM
Old 04-24-2008
Quote:
Originally Posted by aigles
Code:
awk -F, '! mail[$3]++' inputfile

Jean-Pierre.
Jean-Pierre,

This seemed to work but I noticed that there seem to be a few duplicated left behind. How does the array know what the delimiter? $3 is the field, but not clear on delimiter. Would the same work with tabs for delimiter?

Cheers!Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Removing lines that are (same in content) based on columns

I have a file which looks like AA BB CC DD EE FF GG HH KK AA BB GG HH KK FF CC DD EE AA BB CC DD EE UU VV XX ZZ AA BB VV XX ZZ UU CC DD EE .... I want the script to give me only one line based on duplicate contents: AA BB CC DD EE FF GG HH KK AA BB CC DD EE UU VV XX ZZ (7 Replies)
Discussion started by: adsforall
7 Replies

2. Shell Programming and Scripting

Help removing lines with duplicated columns

Hi Guys... Please Could you help me with the following ? aaaa bbbb cccc sdsd aaaa bbbb cccc qwer as you can see, the 2 lines are matched in three fields... how can I delete this pupicate ? I mean to delete the second one if 3 fields were duplicated ? Thanks (14 Replies)
Discussion started by: yahyaaa
14 Replies

3. Shell Programming and Scripting

Finding duplicates from positioned substring across lines

I have million's of records each containing exactly 50 characters and have to check the uniqueness of 4 character substring of 50 character (postion known prior) and report if any duplicates are found. Eg. data... AAAA00000000000000XXXX0000 0000000000... upto50 chars... (2 Replies)
Discussion started by: gapprasath
2 Replies

4. Shell Programming and Scripting

Removing duplicates from string (not duplicate lines)

please help me in getting following: Input Desired output x="foo" foo x="foo foo" foo x="foo foo" foo x="foo abc foo" foo abc x="foo foo1 foo2" foo foo1 foo2 I need to remove duplicated from string.. (8 Replies)
Discussion started by: vickylife
8 Replies

5. Shell Programming and Scripting

finding duplicates in csv based on key columns

Hi team, I have 20 columns csv files. i want to find the duplicates in that file based on the column1 column10 column4 column6 coulnn8 coulunm2 . if those columns have same values . then it should be a duplicate record. can one help me on finding the duplicates, Thanks in advance. ... (2 Replies)
Discussion started by: baskivs
2 Replies

6. Shell Programming and Scripting

Help in removing duplicates

I have an input file abc.txt with info like: abcd rateuse inklite robet rateuse abcd I need to remove duplicates from the file (eg: abcd,rateuse) from the file and need to place the contents in same file abc.txt if needed can be placed in another file. can anyone help me in this :( (4 Replies)
Discussion started by: rkrish
4 Replies

7. Shell Programming and Scripting

Removing duplicates in fixed width file which has multiple key columns

Hi All , I have a requirement where I need to remove duplicates from a fixed width file which has multiple key columns .Also , need to capture the duplicate records into another file . File has 8 columns. Key columns are col1 and col2. Col1 has the length of 8 col 2 has the length of 3. ... (5 Replies)
Discussion started by: saj
5 Replies

8. Shell Programming and Scripting

UNIX scripting for finding duplicates and null records in pk columns

Hi, I have a requirement.for eg: i have a text file with pipe symbol as delimiter(|) with 4 columns a,b,c,d. Here a and b are primary key columns.. i want to process that file to find the duplicates and null values are in primary key columns(a,b) . I want to write the unique records in which... (5 Replies)
Discussion started by: praveenraj.1991
5 Replies

9. Shell Programming and Scripting

Removing duplicates from delimited file based on 2 columns

Hi guys,Got a bit of a bind I'm in. I'm looking to remove duplicates from a pipe delimited file, but do so based on 2 columns. Sounds easy enough, but here's the kicker... Column #1 is a simple ID, which is used to identify the duplicate. Once dups are identified, I need to only keep the one... (2 Replies)
Discussion started by: kevinprood
2 Replies

10. Shell Programming and Scripting

Removing carriage returns from multiple lines in multiple files of different number of columns

Hello Gurus, I have a multiple pipe separated files which have records going over multiple Lines. End of line separator is \n and records going over multiple lines have <CR> as separator. below is example from one file. 1|ABC DEF|100|10 2|PQ RS T|200|20 3| UVWXYZ|300|30 4| GHIJKL|400|40... (7 Replies)
Discussion started by: dJHa
7 Replies
Mail::Server::IMAP4::List(3pm)				User Contributed Perl Documentation			    Mail::Server::IMAP4::List(3pm)

NAME
Mail::Server::IMAP4::List - folder related IMAP4 answers SYNOPSIS
my $imap = Mail::Server::IMAP4::List->new ( folders => $folders # Mail::Box::Identity , inbox => $inbox # Mail::Box , delimiter => '#' ); my $imap = Mail::Server::IMAP4::List->new(user => $user); print $imap->list(...); # for LIST command METHODS
Constructors Mail::Server::IMAP4::List->new(USER) Create a (temporary) object to handle the LIST requests for a certain user, based upon a set of folders. The data is kept by Mail::Box::Identity and Mail::Box::Collection objects, which mean that the folders will not be opened to answer these questions. -Option --Default delimeter '/' folders <from user> inbox <from user> user <undef> delimeter => STRING|CODE Either the constant delimiter, or a code reference which will get passed a folder name and should return the delimiter string used in that name. If that folder name is empty, the default delimiter must be reported. See delimiter() for an example. folders => OBJECT You need to specify either a set of folders explicitly or via the user. Some Mail::Box::Identity OBJECT is needed. inbox => BOOLEAN For now, only used to see whether there is an inbox, so a truth value will do. This may change in the future. By default, the flag is set if "$user-"inbox> is defined. user => OBJECT A Mail::Box::Manage::User OBJECT, representing the user who's folders must get reported. Attributes $obj->delimiter([FOLDERNAME]) Returns the delimiter string. The foldername is only required when a CODE reference was specified at initiation. example: setting-up an IMAP4 delimeter sub delim($) { my $path = shift; my ($delim, $root) = $path =~ m/^(#news.)/ ? ('.', $1) = $path =~ m!^/! ? ('/', '/') : ('/', ''); wantarray ? ($delim, $root) : $delim; } my $list = Mail::Server::IMAP4::List->new(delimiter => &delim, ...); print $list->delimiter('abc/xyz'); # returns a / (slash) and '' print $list->delimiter('#news.feed'); # returns a . (dot) and $news. print $list->delimiter(''); # returns default delimiter $obj->folders() Returns the Mail::Box::Identity of the toplevel folder. $obj->inbox() Returns the Mail::Box or filename of the INBOX. $obj->user() Returns the Mail::Box::Manage::User object, if defined. IMAP Commands $obj->list(BASE, PATTERN) IMAP's LIST command. The request must be partially decoded, the answer will need to be encoded. example: using IMAP list my $imap = Mail::Server::IMAP4::List->new(delimiter => &delim, ...); local $" = ';'; my @lines = $imap->list('', ''); # returns the default delimiter print ">@{$lines[0]}<"; # >(Noselect);/;< my @lines = $imap->list('#news',''); # specific delimiter print ">@{$lines[0]}<"; # >(Noselect);.;< my @lines = $imap->list('top/x/', '%'); print ">@$_<," foreach @lines; # >();/;/tmp/x/y<,>(Marked);/;/tmp/x/z< DETAILS
See RFC2060: "Internet Message Access Protocol IMAP4v1" sections 6.3.8 (LIST question) and 7.2.2 (LIST answer) SEE ALSO
This module is part of Mail-Box distribution version 2.105, built on May 07, 2012. Website: http://perl.overmeer.net/mailbox/ LICENSE
Copyrights 2001-2012 by [Mark Overmeer]. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.14.2 2012-05-07 Mail::Server::IMAP4::List(3pm)
All times are GMT -4. The time now is 11:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy