11-21-2005
grep string & next n lines
need help on this. let say i hv 1 file contains as below:
STRING
Description bla bla bla
Description yada yada yada
Data bla bla
Data yada yada
how do i want to display n lines after the string?
thanks in advance!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi experts,
I want to grep a number 9366109380 from a file but it will also show me the next 5 lines. Below is the example-
when i grep 989366109380, i can also see the next 5 lines.
Line 1. <fullOperation>MAKE:NUMBER:9366109380:PPAY2;</fullOperation>
Line 2.... (10 Replies)
Discussion started by: thepurple
10 Replies
2. Shell Programming and Scripting
i need to grep a STRING_A & the next few lines after the STRING_A
example file:
STRING_A yada yada
line 1
line 2
STRING_B yada yada
line 1
line 2
line 3
STRING_A yada yada
line 1
line 2
line 3
line 4
STRING_A yada yada
line 1
line 2
line 3
line 4 (7 Replies)
Discussion started by: ashterix
7 Replies
3. Shell Programming and Scripting
Hi,
I have a log file that I need to monitor as it's being written to, and I want to exclude certain strings from the output. At the moment I'm using ...
tail -f LogFileName_`date +%d`.log | egrep -v "First String To Exclude | 2nd string | 3rd string" ...which works OK - but now I need to... (1 Reply)
Discussion started by: jake657
1 Replies
4. Shell Programming and Scripting
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)
Discussion started by: jbruce
7 Replies
5. Shell Programming and Scripting
Hi All,
Please tell me how can I Find a string using grep & print the line above or below that in solaris?
Please share as I am unable to use grep -A or grep -B as it is not working on Solaris. (10 Replies)
Discussion started by: Zaib
10 Replies
6. Shell Programming and Scripting
Hi,
1_strings file contains
$ cat 1_strings
/home/$USER/Src
/home/Valid
/home/Review$ cat myxml
<projected value="some string" path="/home/$USER/Src">
<input 1/>
<estimate value/>
<somestring/>
</projected>
<few more lines >
<projected value="some string" path="/home/$USER/check">... (4 Replies)
Discussion started by: greet_sed
4 Replies
7. Shell Programming and Scripting
Hello,
I want to extract from a file like :
20120530025502914 | REQUEST | whatever
20120530025502968 | RESPONSE | whatever
20120530025502985 | RESPONSE | whatever
20120530025502996 | REQUEST | whatever
20120530025503013 | REQUEST | whatever
20120530025503045 | RESPONSE | whatever
I want... (14 Replies)
Discussion started by: black_fender
14 Replies
8. Shell Programming and Scripting
.......
06/09/2013|12:00:00 PM|3|26112|40|44032|27419.7|6 1 0 93 |6|1|0|93
06/09/2013|12:30:00 PM|3|26112|40|44032|27491|11 4 0 85 |11|4|0|85
I have "sysperf.out" file containing the lines above.
What I like to have on the output is:
Node: prod1db ===> this is the hostname
Date:... (7 Replies)
Discussion started by: Daniel Gate
7 Replies
9. Shell Programming and Scripting
I have a large dataset with following structure;
C 0001 Carbon
D SAR001 methane
D SAR002 ethane
D SAR003 propane
D SAR004 butane
D SAR005 pentane
C 0002 Hydrogen
C 0003 Nitrogen
C 0004 Oxygen
D SAR011 ozone
D SAR012 super oxide
C 0005 Sulphur
D SAR013... (3 Replies)
Discussion started by: Syeda Sumayya
3 Replies
10. Shell Programming and Scripting
say we have :
2914 | REQUEST | whatever
2914 | RESPONSE | whatever
2914 | SUCCESS | whatever
2985 | RESPONSE | whatever
2986 | REQUEST | whatever
2990 | REQUEST | whatever
2985 | RESPONSE | whatever
2996 | REQUEST | whatever
2010 | SUCCESS | whatever
2013 | REQUEST | whatever
2013 |... (7 Replies)
Discussion started by: Saumitra Pandey
7 Replies
LEARN ABOUT SUSE
pdl::opt::simplex
Simplex(3) User Contributed Perl Documentation Simplex(3)
NAME
PDL::Opt::Simplex -- Simplex optimization routines
SYNOPSIS
use PDL::Opt::Simplex;
($optimum,$ssize) = 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.
$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) = 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.12.1 2009-10-17 Simplex(3)