In this case you might have to write something in awk for example to have a similar functionality.
Althoug there is an old version of GNUgrep in the official IBM Linux toolbox available, just in case you were allowed to install this one.
---------- Post updated at 05:32 PM ---------- Previous update was at 04:30 PM ----------
Without focus on parsing input etc., here a solution in awk how it could look like:
Examples:
Dear Experts,
I have file called file1 in which i am greping a pattern after that i want to next 3 lines when that pattern is matched.
Ex:- file1
USA
UK
India
Africa
Hello
Asia
Europe
Australia
Hello
Peter
Robert
Jo
i want to next 3 lines after matching Hello... (12 Replies)
I have several very large file that are extracts from Oracle tables. These files are formatted in XML type syntax with multiple entries like:
<ROW>
some information
more information
</ROW>
I want to grep for some words, then print all lines between <ROW> AND </ROW>. Can this be done with AWK?... (7 Replies)
Hello everyone,
I have a little script below:
die "Usage infile outfile reGex" if @ARGV != 3;
($regex) = @ARGV;
open(F,$ARGV) or die "Can't open";
open(FOUT,"+>$ARGV") or die "Can't open";
while (<F>)
{
print FOUT if /$regex/.../$regex/;
}
No matter what I give $regex on the... (2 Replies)
Hi Guys,
I have file like below, I want to print all lines between test1231233 to its 10 occurrence(till line 41)
test1231233
qwe
qwe
qweq123
test1231233
qwe
qwe
qweq23
test1231233
qwe
qwe
qweq123
test1231233
qwe
qwe
qweq123131 (3 Replies)
Hello,
I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Hi,
here are few lines present in the logs. I want to grep on Error and print few lines before and after Error word is found
line1
Line2
Line3
Error
Line4
Line5
Line6
Line7
I want the output to be
Line2
Line3
Error
Line5 (1 Reply)
would like to print everything after matching two patterns AAA and BBB.
output :
CCC
ZZZ
sample data :
AAA
BBB
CCC
ZZZ (4 Replies)
Discussion started by: jhonnyrip
4 Replies
LEARN ABOUT DEBIAN
pdl::opt::simplex
Simplex(3pm) User Contributed Perl Documentation Simplex(3pm)NAME
PDL::Opt::Simplex -- Simplex optimization routines
SYNOPSIS
use PDL::Opt::Simplex;
($optimum,$ssize,$optval) = simplex($init,$initsize,$minsize,
$maxiter,
sub {evaluate_func_at($_[0])},
sub {display_simplex($_[0])}
);
DESCRIPTION
This package implements the commonly used simplex optimization algorithm. The basic idea of the algorithm is to move a "simplex" of N+1
points in the N-dimensional search space according to certain rules. The main benefit of the algorithm is that you do not need to calculate
the derivatives of your function.
$init is a 1D vector holding the initial values of the N fitted parameters, $optimum is a vector holding the final solution. $optval is
the evaluation of the final solution.
$initsize is the size of $init (more...)
$minsize is some sort of convergence criterion (more...) - e.g. $minsize = 1e-6
The sub is assumed to understand more than 1 dimensions and threading. Its signature is 'inp(nparams); [ret]out()'. An example would be
sub evaluate_func_at {
my($xv) = @_;
my $x1 = $xv->slice("(0)");
my $x2 = $xv->slice("(1)");
return $x1**4 + ($x2-5)**4 + $x1*$x2;
}
Here $xv is a vector holding the current values of the parameters being fitted which are then sliced out explicitly as $x1 and $x2.
$ssize gives a very very approximate estimate of how close we might be - it might be miles wrong. It is the euclidean distance between the
best and the worst vertices. If it is not very small, the algorithm has not converged.
FUNCTIONS
simplex
Simplex optimization routine
($optimum,$ssize,$optval) = simplex($init,$initsize,$minsize,
$maxiter,
sub {evaluate_func_at($_[0])},
sub {display_simplex($_[0])}
);
See module "PDL::Opt::Simplex" for more information.
CAVEATS
Do not use the simplex method if your function has local minima. It will not work. Use genetic algorithms or simulated annealing or
conjugate gradient or momentum gradient descent.
They will not really work either but they are not guaranteed not to work ;) (if you have infinite time, simulated annealing is guaranteed
to work but only after it has visited every point in your space).
SEE ALSO
Ron Shaffer's chemometrics web page and references therein: "http://chem1.nrl.navy.mil/~shaffer/chemoweb.html".
Numerical Recipes (bla bla bla XXX ref).
The demonstration (Examples/Simplex/tsimp.pl and tsimp2.pl).
AUTHOR
Copyright(C) 1997 Tuomas J. Lukka. All rights reserved. There is no warranty. You are allowed to redistribute this software /
documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL
distribution, the copyright notice should be included in the file.
perl v5.14.2 2012-01-02 Simplex(3pm)