Hi,
I want to input unix variable to sqlplus.The following is working fine
sqlplus username/password @dummy.sql param1 param2 << EOF
create user $1 identified by $2;
EOF
But I dont want any file name to be passed,I just want to pass the parameter. Is there any way to that??
Thanks... (3 Replies)
Hi,
In normal shell scripting, how do you pass the output of a command to a variable, instead of a file and be able to use it later?
The code is:
#!/bin/bash
who | cut -d" " -f1 > onlineusers
Instead of passing the output of the above command to the file called 'onlineusers'... (1 Reply)
Hi all,
I have a script in file1 which gets input from the user say variable "TYPE". This variable is present in the other file2. I want to replace the variable in the file2 with the value given by the user and print the file. How can I achieve this task?
file1
code
echo "Give... (3 Replies)
Hi,
How can I modify the FILETYPE command ?
I want to provide the file extension, like txt, root .?
Thanks,
#!/bin/bash
FROM=$1
TO=$2
FILETYPE=$3
... (4 Replies)
All,
I have a log file containing lots of data now i want to extract all text between block below(names) without the title or end pattern but only names,
++++START++++
SCOTT TIGER
HENRY PAUL
JARED OTIENO
OMOLLO JA NIGERIA
++++END++++
the names i want to return and store in a variable in... (1 Reply)
Hi Guys,
i have a file where data is in the below format::
data1 data2
data3 data4
data4 data6
my script written as::
#!/bin/ksh
cd $1
at now <<END
sh $2
END
Here i want to pass the values stored in the above file one by one till the end of line.
Here if i am doing it as:: (2 Replies)
cat a1
scott
robert
tom
test
script :
#!/usr/bin/ksh
for NAME in `cat a1`
do
VALUE=`sqlplus -silent "nobody/bobody01@testq" <<END
set pagesize 0 feedback off verify off heading off echo off
select username from dba_users where username=upper('$NAME');
END`
if ; then
echo... (3 Replies)
Hi all,
I have a file looks like
AAAA 111
BBBB 222
CCCC 333
need to pass variable value like var1=AAAA and var2=111
to another command for three times with next values.
stuck over here
cat file | while read line
do
export var1=`awk '{print $1}'`
echo $var1
export var2=`cat file... (3 Replies)
The red text at the bottom represents the three lines I want to address.
I'm dynamically creating a bsub with a perl script and would like to create the fasta_16S variable in a single line....not three. I'm having difficulty in getting the syntax correct. Obviously, there is some confusion... (3 Replies)
Below is the command
mv AP_FLEXCUBE_INTERFACE10.txt FTPYMNTE_`date "+%Y%m%d%H%M%S" | tr '' ''`.TXT
it is changing the file name to a different name according to time stamp dynamically. I want to capture that dynamic file name present in the directory to a variable .
After that i want to... (6 Replies)
Discussion started by: sujit das
6 Replies
LEARN ABOUT DEBIAN
statistics::basic::leastsquarefit
Statistics::Basic::LeastSquareFit(3pm) User Contributed Perl Documentation Statistics::Basic::LeastSquareFit(3pm)NAME
Statistics::Basic::LeastSquareFit - find the least square fit for two lists
SYNOPSIS
A machine to calculate the Least Square Fit of given vectors x and y.
The module returns the alpha and beta filling this formula:
$y = $beta * $x + $alpha
for a given set of x and y co-ordinate pairs.
Say you have the set of Cartesian coordinates:
my @points = ( [1,1], [2,2], [3,3], [4,4] );
The simplest way to find the LSF is as follows:
my $lsf = lsf()->set_size(int @points);
$lsf->insert(@$_) for @points;
Or this way:
my $xv = vector( map {$_->[0]} @points );
my $yv = vector( map {$_->[1]} @points );
my $lsf = lsf($xv, $yv);
And then either query the values or print them like so:
print "The LSF for $xv and $yv: $lsf
";
my ($yint, $slope) =
my ($alpha, $beta) = $lsf->query;
LSF is meant for finding a line of best fit. $beta is the slope of the line and $alpha is the y-offset. Suppose you want to draw the
line. Use these to calculate the "x" for a given "y" or vice versa:
my $y = $lsf->y_given_x( 7 );
my $x = $lsf->x_given_y( 7 );
(Note that "x_given_y()" can sometimes produce a divide-by-zero error since it has to divide by the $beta.)
Create a 20 point "moving" LSF like so:
use Statistics::Basic qw(:all nofill);
my $sth = $dbh->prepare("select x,y from points where something");
my $len = 20;
my $lsf = lsf()->set_size($len);
$sth->execute or die $dbh->errstr;
$sth->bind_columns( my ($x, $y) ) or die $dbh->errstr;
my $count = $len;
while( $sth->fetch ) {
$lsf->insert( $x, $y );
if( defined( my ($yint, $slope) = $lsf->query ) {
print "LSF: y= $slope*x + $yint
";
}
# This would also work:
# print "$lsf
" if $lsf->query_filled;
}
METHODS
This list of methods skips the methods inherited from Statistics::Basic::_TwoVectorBase (things like insert(), and ginsert()).
new()
Create a new Statistics::Basic::LeastSquareFit object. This function takes two arguments -- which can either be arrayrefs or
Statistics::Basic::Vector objects. This function is called when the leastsquarefirt() shortcut-function is called.
query()
LSF is meant for finding a line of best fit. $beta is the slope of the line and $alpha is the y-offset.
my ($alpha, $beta) = $lsf->query;
y_given_x()
Automatically calculate the y-value on the line for a given x-value.
my $y = $lsf->y_given_x( 7 );
x_given_y()
Automatically calculate the x-value on the line for a given y-value.
my $x = $lsf->x_given_y( 7 );
"x_given_y()" can sometimes produce a divide-by-zero error since it has to divide by the $beta. This might be helpful:
if( defined( my $x = eval { $lsf->x_given_y(7) } ) ) {
warn "there is no x value for 7";
} else {
print "x (given y=7): $x
";
}
query_vector1()
Return the Statistics::Basic::Vector for the first vector used in the computation of alpha and beta.
query_vector2()
Return the Statistics::Basic::Vector object for the second vector used in the computation of alpha and beta.
query_mean1()
Returns the Statistics::Basic::Mean object for the first vector used in the computation of alpha and beta.
query_variance1()
Returns the Statistics::Basic::Variance object for the first vector used in the computation of alpha and beta.
query_covariance()
Returns the Statistics::Basic::Covariance object used in the computation of alpha and beta.
OVERLOADS
This object is overloaded. It tries to return an appropriate string for the calculation, but raises an error 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::LeastSquareFit(3pm)