I have a situation where I am reading a text file line-by-line. Those lines of data contain comma separated fields of data. However, each line can vary in the number of fields it can contain. What I need to do is parse apart each line and write each field of data found (left to right) into a file.... (7 Replies)
I've created an awk script that handles a varying number of search strings handed to it as command line parameters ($1 $2 etc). There may be 1, or 2 or 3 or more. A simplified version of the script is:
awk -v TYP="$1 $2 $3 $4 $5 $6" '
BEGIN {
CTYP = split (TYP,TYPP," ")
}
... (2 Replies)
Hi Folks,
I am trying to make a script to assign all diskspace to slice 0, on multiple sized disks. Since the disks are new they may need to be labelled also to avoid the error: Cannot get disk geometry
Below is my code struggling with logic which doesn't seem to be producing the desired... (0 Replies)
Hi All,
My file has the records as below:
aaa\bbb\c\dd\ee\ff\gg
zz\vv\ww
pp\oo\ii\uu
How can I get the value after the last delimeter.
My o/p:
gg
ww
uu
Thanks in Advance, (5 Replies)
Got struck while trying to write a shell script which should automatically give input.
While running a script for eg: (adpatch.sh)
It Prompts for Multiple inputs like:
Do you currently have files used for installing or upgrading the database
installed in this APPL_TOP ? need to give... (2 Replies)
Hi Guy's.
Hopefully someone can help me with what I am trying to archieve.
So situation currently is, I have a script already setup however I have another script that sits infront of it.
The main script basically goes and searchs multiple platforms for a list of entered data.
In... (10 Replies)
Hi,
I am new in perl.
I am running a perl installation script, its asking for paths and so many inputs.
Can we provide that info by any file.
so i can avoid the interactive installation. (2 Replies)
Hi,
I want a script which search for a pattern "good" in a huge file and provide me number of occurences of such pattern in a file.
lets say i have a file test.txt contents as below
good is good
but good is sometime bad and sometime good
you are very good and good is always good
... (7 Replies)
I have a text file in this format
Some lines....
Question no: 1
The question?
A. Answer 1
B. Answer 2
C. Answer 3
D. Answer 4
Answer:B
Some lines....
Question no: 2
The question? (choose 2) (10 Replies)
Discussion started by: zorrox
10 Replies
LEARN ABOUT DEBIAN
statistics::basic::correlation
Statistics::Basic::Correlation(3pm) User Contributed Perl Documentation Statistics::Basic::Correlation(3pm)NAME
Statistics::Basic::Correlation - find the correlation between two lists
SYNOPSIS
Invoke it this way:
my $correlation = correlation( [1,2,3], [1,2,3] );
Or this way:
my $v1 = vector(1,2,3);
my $v2 = vector(1,2,3);
my $cor = corr($v1,$v2);
And then either query the values or print them like so:
print "The correlation between $v1 and $v2: $correlation
";
my $cq = $cor->query;
my $c0 = 0+$correlation;
Create a 20 point "moving" correlation like so:
use Statistics::Basic qw(:all nofill);
my $sth = $dbh->prepare("select col1,col2 from data where something");
my $len = 20;
my $cor = corr()->set_size($len);
$sth->execute or die $dbh->errstr;
$sth->bind_columns( my ($lhs, $rhs) ) or die $dbh->errstr;
my $count = $len;
while( $sth->fetch ) {
$cor->insert( $lhs, $rhs );
if( defined( my $c = $cor->query ) ) {
print "Correlation: $c
";
}
# This would also work:
# print "Correlation: $cor
" if $cor->query_filled;
}
METHODS
This list of methods skips the methods inherited from Statistics::Basic::_TwoVectorBase (things like query(), insert(), and ginsert()).
new()
Create a new Statistics::Basic::Correlation object. This function takes two arguments -- which can either be arrayrefs or
Statistics::Basic::Vector objects. This function is called when the correlation() shortcut-function is called.
query_covariance()
Returns the Statistics::Basic::Covariance object used to calculate the correlation.
query_vector1()
Return the Statistics::Basic::Vector for the first vector.
query_vector2()
Return the Statistics::Basic::Vector object for the second vector.
query_mean1()
Returns the Statistics::Basic::Mean object for the first vector.
query_mean2()
Returns the Statistics::Basic::Mean object for the second vector.
OVERLOADS
This object is overloaded. It tries to return an appropriate string for the calculation or the value of the computation in numeric
context.
In boolean context, this object is always true (even when empty).
AUTHOR
Paul Miller "<jettero@cpan.org>"
COPYRIGHT
Copyright 2012 Paul Miller -- Licensed under the LGPL
SEE ALSO perl(1), Statistics::Basic, Statistics::Basic::_TwoVectorBase, Statistics::Basic::Vector
perl v5.14.2 2012-01-23 Statistics::Basic::Correlation(3pm)