03-23-2016
It's two passes across the same file - first pass to count the occurrences, the second to print the fields plus the count.
This User Gave Thanks to RudiC For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have the following lines in a file
SANDI108085FRANKLIN WRAP 7285
SANDI109514ZIPLOC STRETCH N SEAL 7285
SANDI110198CHOICE DM 0911
SANDI111144RANDOM WEIGHT BRAND 0704
SANDI111144RANDOM WEIGHT BRAND 0738... (10 Replies)
Discussion started by: dhanamurthy
10 Replies
2. Shell Programming and Scripting
Hi All,
i need ti delete two duplicate processss which are running on the same device type (column 1) and port ID (column 2). here is the sample data
p1sc1m1 15517 11325 0 01:00:24 ? 0:00 scagntclsx25octtcp 2967 in3v mvmp01 0 8000 N S 969 750@751@752@
p1sc1m1 15519 11325 0 01:00:24 ? ... (5 Replies)
Discussion started by: neeraj617
5 Replies
3. Shell Programming and Scripting
Given a file such as this I need to remove the duplicates.
00060011 PAUL BOWSTEIN ad_waq3_921_20100826_010517.txt
00060011 PAUL BOWSTEIN ad_waq3_921_20100827_010528.txt
0624-01 RUT CORPORATION ad_sade3_10_20100827_010528.txt
0624-01 RUT CORPORATION ... (13 Replies)
Discussion started by: script_op2a
13 Replies
4. Shell Programming and Scripting
Hi Experts,
I have many CSV data files in the below format (Example) :-
Doc Number,Line Number,Condition Number
111,10,ABC
111,10,PQR
111,10,XYZ
222,20,DEF
222,20,EFG
222,20,HIJ
333,30,CCC
333,30,TCP
Now, for the above data i want to get the row count based on the Doc Number & Line... (9 Replies)
Discussion started by: naikamit
9 Replies
5. UNIX for Dummies Questions & Answers
I have a delimited file (by |), and the second field is made out of Surnames.
Is it possible to list the surnames together with their count of occurances.
For example, image the first two lines are the following:
Joe | Doe | 30
Jane | Doe | 28
Peter | Smith | 25
John | Jones | 26
I... (2 Replies)
Discussion started by: mouthpiec
2 Replies
6. Shell Programming and Scripting
Hi all,
I have found another post threads talking about count duplicate lines, but I am interested in obtain the total number of duplicates. For example:
#file.txt
a1
a2
a1
a3
a1
a2
a4
a5
#out
3 (lines are duplicates)
Thank you! (12 Replies)
Discussion started by: mikloz
12 Replies
7. Shell Programming and Scripting
Hi all,
I have huge a tab-delimited file with the following format and I want to remove the duplicates according to their frequency based on Column2 and Column3.
Column1 Column2 Column3 Column4 Column5 Column6 Column7
1 user1 access1 word word 3 2
2 user2 access2 ... (10 Replies)
Discussion started by: corfuitl
10 Replies
8. Shell Programming and Scripting
Hello all,
I would like to ask your help here:
I've a huge file that has 2 columns. A part of it is:
sorted.txt:
kss23 rml.67lkj
kss23 zhh.6gf
kss23 nhd.09.fdd
kss23 hp.767.88.89
fl67 nmdsfs.56.df.67
fl67 kk.fgf.98.56.n
fl67 bgdgdfg.hjj.879.d
fl66 kl..hfh.76.ghg
fl66... (5 Replies)
Discussion started by: Padavan
5 Replies
9. Shell Programming and Scripting
Dear All,
I really enjoy your help or suggestion for resolving an issue.
Briefly, I have a file like this:
a b c
a d e
f g h
k g h
x y z
If the first column has the same ID, for example a, just remove it.
The output should be this:
f g h
k g h
x y z
I was thinking to do it... (11 Replies)
Discussion started by: giuliangiuseppe
11 Replies
10. Shell Programming and Scripting
Hi Experts,
Please bear with me, i need help
I am learning AWk and stuck up in one issue.
First point : I want to sum up column value for column 7, 9, 11,13 and column15 if rows in column 5 are duplicates.No action to be taken for rows where value in column 5 is unique.
Second point : For... (1 Reply)
Discussion started by: as7951
1 Replies
LEARN ABOUT DEBIAN
test::pop3
Test::POP3(3pm) User Contributed Perl Documentation Test::POP3(3pm)
NAME
Test::POP3 - Automate Email Delivery Tests
SYNOPSIS
use Test::POP3;
my $pop = Test::POP3->new({
host => $host,
user => $user,
pass => $pass,
});
# this will delete all messages from the server
ok($count == $pop->wait_for_email_count($count,$timeout),"got $count");
# find and delete a single email message which matches these rules
# see Test::Email for more information
$pop->ok({
# optional search parameters
to => ($is or qr/is like/),
from => ($is or qr/is like/),
subject => ($is or qr/is like/),
body => ($is or qr/is like/),
headername => ($is or qr/is like/),
}, "got message");
ok($pop->get_email_count() == $count, "$count emails in cache");
# get the Test::Email object
my @email = $pop->get_email();
ok($pop->delete_all() == 2, "deleted 2 messages");
# tweak MIME::Parser settings
my $parser = $pop->get_parser();
DESCRIPTION
Please note that this is ALPHA CODE. As such, the interface is likely to change.
This module can help you to create automated tests of email delivered to a POP3 account.
Messages retrieved from the server but not yet matched by a test will be cached until either that message is the first to pass a test, or
is returned by "$pop3->get_email()". Messages returned are Test::Email objects.
METHODS
"my $pop = Test::POP3->new($href);"
The arguments passed in the href are host, user, and pass.
"my $count = $pop->wait_for_email_count($count, $timeout_seconds?);"
Calling this method will result in all messages being deleted from the server. This will wait up to $timeout seconds for there to be
$count unprocessed messages found on the server. After $count or more messages are found, or after $timeout seconds, the current email
count will be returned. $timeout_seconds defaults to 30.
"my @email = $pop->get_email();"
Get all of the email messages currently in local cache. You should call "$pop3->wait_for_email_count($count)" before calling this
method if you think that there may be messages on the server yet to be retrieved. Calling this method will cause the local cache to be
emptied. Email messages returned will be Test::Email objects.
"my $count = $pop->get_email_count($check_server);"
This will return the number of email messages in the cache. If $check_server is true, then the server will be checked once before the
count is determined. If you would like to wait for messages to arrive on the server, and then be downloaded prior to counting, use
"$pop3->wait_for_email_count()".
"my $ok = $pop->ok($test_href, $description);"
Calling this method will cause the email in the local cache to be tested, according to the contents of $test_href. The first email
which passes all tests will be deleted from the local cache. Since this method only checks the local cache, you will want to call
"$pop3->wait_for_email_count()" before calling this method. "ok" will produce TAP output, identical to "Test::Simple::ok" and
"Test::More::ok".
"my $parser = $pop->get_parser();"
Test::POP3 uses MIME::Parser to process the messages. (MIME is not yet handled by "Test::Email", it will be soon.) Use this method if
you want to manage the parser.
EXPORT
None.
SEE ALSO
Test::Builder, Test::Simple, Test::More, MIME::Parser
AUTHOR
James Tolley, <james@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2007 by James Tolley
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.
perl v5.10.0 2008-10-24 Test::POP3(3pm)