10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I have a file that contains multiple records of the same database.
I need to search for the maximum size of the database. At the moment, I am doing as below:
Sample generated file to parse is as below. With the caret (^) delimiter, field 1 is the database name, 2 is the database ID and... (3 Replies)
Discussion started by: newbie_01
3 Replies
2. Shell Programming and Scripting
I want to duplicate each row in my file
Egfile.txt
Name State Age
Jack NJ 34
John MA 23
Jessica FL 45
I want the code to produce this output
Name State Age
Jack NJ 34
Jack NJ 34
John MA 23
John MA 23
Jessica FL 45
Jessica FL 45 (6 Replies)
Discussion started by: sidnow
6 Replies
3. UNIX for Dummies Questions & Answers
Hi all
I have a file that has two columns and I need the maximum value in column 2 of 4 positions o rows. for example at position {1..3} there are 4 characters (A, C, G and T) each of these characters with a value with a value in column 2. I need the maximum value in column 2 and the corresponding... (2 Replies)
Discussion started by: xinox
2 Replies
4. Programming
I feel stupid for asking this because it seems that MYSQL code isn't working the way that I think it should work.
Basically I wrote code like this:
select * from `Test_DC_Trailer` HAVING max(DR_RefKey);
Where the DR_RefKey is a unique numeric field that is auto iterated (like a primary key)... (7 Replies)
Discussion started by: Astrocloud
7 Replies
5. Shell Programming and Scripting
Hi,
This is a followup to my earlier post
him mno klm 20 76 . + . klm_mango unix_00000001;
alp fdc klm 123 456 . + . klm_mango unix_0000103;
her tkr klm 415 439 . + . klm_mango unix_00001043;
abc tvr klm 20 76 . + . klm_mango unix_00000001;
abc def klm 83 84 . + . klm_mango... (5 Replies)
Discussion started by: jacobs.smith
5 Replies
6. Programming
Hi ,
I have a data file in this format.
p1 p2 p3
10 0
10 0 1000
I am using a sqlloader script to load the data into the database table.There is a unique constraint on the columns p1 and p2.
So, sqlldr cannot load both the records. This eliminates duplicate records from being... (1 Reply)
Discussion started by: megha2525
1 Replies
7. Shell Programming and Scripting
Hi! I have a file as below:
line1
line2
line2
line3
line3
line3
line4
line4
line4
line4
I would like to extract duplicate lines (not unique, triplicate or quadruplicate lines). Output will be as below:
line2
line2
I would appreciate if anyone can help. Thanks. (4 Replies)
Discussion started by: chromatin
4 Replies
8. HP-UX
Hi all,
I have written one shell script. The output file of this script is having sql output.
In that file, I want to extract the rows which are having multiple entries(duplicate rows).
For example, the output file will be like the following way.
... (7 Replies)
Discussion started by: raghu.iv85
7 Replies
9. Shell Programming and Scripting
I have searched the internet for duplicate row extracting.
All I have seen is extracting good rows or eliminating duplicate rows.
How do I extract duplicate rows from a flat file in unix.
I'm using Korn shell on HP Unix.
For.eg.
FlatFile.txt
========
123:456:678
123:456:678
123:456:876... (5 Replies)
Discussion started by: bobbygsk
5 Replies
10. Shell Programming and Scripting
hi all
can anyone please let me know if there is a way to find out duplicate rows in a file. i have a file that has hundreds of numbers(all in next row).
i want to find out the numbers that are repeted in the file.
eg.
123434
534
5575
4746767
347624
5575
i want 5575
please help (3 Replies)
Discussion started by: infyanurag
3 Replies
VecStat(3pm) User Contributed Perl Documentation VecStat(3pm)
NAME
Math::VecStat - Some basic numeric stats on vectors
SYNOPSIS
use Math::VecStat qw(max min maxabs minabs sum average);
$max=max(@vector);
$max=max(@vector);
($max,$imax)=max(@vector);
($max,$imax)=max(@vector);
$min=min(@vector);
$min=min(@vector);
($max,$imin)=min(@vector);
($max,$imin)=min(@vector);
$max=maxabs(@vector);
$max=maxabs(@vector);
($max,$imax)=maxabs(@vector);
($max,$imax)=maxabs(@vector);
$min=minabs(@vector);
$min=minabs(@vector);
($max,$imin)=minabs(@vector);
($max,$imin)=minabs(@vector);
$sum=sum($v1,$v2,...);
$sum=sum(@vector);
$sum=sum(@vector);
$average=average($v1,$v2,...);
$av=average(@vector);
$av=average(@vector);
$ref=vecprod($scalar,@vector);
$ok=ordered(@vector);
$ok=ordered(@vector);
$ref=sumbyelement(@vector1,@vector2);
$ref=diffbyelement(@vector1,@vector2);
$ok=allequal(@vector1,@vector2);
$ref=convolute(@vector1,@vector2);
DESCRIPTION
This package provides some basic statistics on numerical vectors. All the subroutines can take a reference to the vector to be operated on.
In some cases a copy of the vector is acceptable, but is not recommended for efficiency.
max(@vector), max(@vector)
return the maximum value of given values or vector. In an array context returns the value and the index in the array where it occurs.
min(@vector), min(@vector)
return the minimum value of given values or vector, In an array context returns the value and the index in the array where it occurs.
maxabs(@vector), maxabs(@vector)
return the maximum value of absolute of the given values or vector. In an array context returns the value and the index in the array
where it occurs.
minabs(@vector), minabs(@vector)
return the minimum value of the absolute of the given values or vector. In an array context returns the value and the index in the
array where it occurs.
sum($v1,$v2,...), sum(@vector), sum(@vector)
return the sum of the given values or vector
average($v1,$v2,..), average(@vector), average(@vector)
return the average of the given values or vector
vecprod($a,$v1,$v2,..), vecprod($a,@vector), vecprod( $a, @vector )
return a vector built by multiplying the scalar $a by each element of the @vector.
ordered($v1,$v2,..), ordered(@vector), ordered(@vector)
return nonzero iff the vector is nondecreasing with respect to its index. To be used like
if( ordered( $lowBound, $value, $highBound ) ){
instead of the (slightly) more clumsy
if( ($lowBound <= $value) && ($value <= $highBound) ) {
sumbyelement( @array1, @array2 ), diffbyelement(@array1,@array2)
return the element-by-element sum or difference of two identically-sized vectors. Given
$s = sumbyelement( [10,20,30], [1,2,3] );
$d = diffbyelement( [10,20,30], [1,2,3] );
$s will be "[11,22,33]", $d will be "[9,18,27]".
allequal( @array1, @array2 )
returns true if and only if the two arrays are numerically identical.
convolute( @array1, @array2 )
return a reference to an array containing the element-by-element product of the two input arrays. I.e.,
$r = convolute( [1,2,3], [-1,2,1] );
returns a reference to
[-1,4,3]
median
evaluates the median, i.e. an element which separates the population in two halves. It returns a reference to a list whose first
element is the median value and the second element is the index of the median element in the original vector.
$a = Math::VecStat::median( [9,8,7,6,5,4,3,2,1] );
returns the list reference
[ 5, 4 ]
i.e. the median value is 5 and it is found at position 4 of the original array.
If there are several elements of the array having the median value, e.g. [1,3,3,3,5]. In this case we choose always the first element
in the original vector which is a median. In the example, we return [3,1]. =back =head1 HISTORY
$Log: VecStat.pm,v $
Revision 1.9 2003/04/20 00:49:00 spinellia@acm.org
Perl 5.8 broke test 36, exposing inconsistency in C<median>. Fixed, thanks to david@jamesgang.com.
Revision 1.8 2001/01/26 11:10:00 spinellia@acm.org
Added function median.
Fixed test, thanks to Andreas Marcel Riechert <riechert@pobox.com>
Revision 1.7 2000/10/24 15:28:00 spinellia@acm.org
Added functions allequal diffbyelement
Created a reasonable test suite.
Revision 1.6 2000/06/29 16:06:37 spinellia@acm.org
Added functions vecprod, convolute, sumbyelement
Revision 1.5 1997/02/26 17:20:37 willijar
Added line before pod header so pod2man installs man page correctly
Revision 1.4 1996/02/20 07:53:10 willijar
Added ability to return index in array contex to max and min
functions. Added minabs and maxabs functions.
Thanks to Mark Borges <mdb@cdc.noaa.gov> for these suggestions.
Revision 1.3 1996/01/06 11:03:30 willijar
Fixed stupid bug that crept into looping in min and max functions
Revision 1.2 1995/12/26 09:56:38 willijar
Oops - removed xy data functions.
Revision 1.1 1995/12/26 09:39:07 willijar
Initial revision
BUGS
Let me know. I welcome any appropriate additions for this package.
AUTHORS
John A.R. Williams <J.A.R.Williams@aston.ac.uk> Andrea Spinelli <spinellia@acm.org>
perl v5.12.4 2011-07-11 VecStat(3pm)