12-19-2008
ammu,
Try this script, if it were called... myscript.pl
chmod 755 myscript.pl
cat file1 | ./myscript.pl
#!/usr/bin/env perl
$p=0;
$c=0;
while (<STDIN>) {
if ($p == 0 && m/ERROR/) {
$p=1;
$c=$. + 10;
}
if ($p == 1) {
if ($. < $c) {
print $_;
} else {
last;
}
}
}
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello People,
Need some assistance/guidance.
OUTLINE:
Two files (File1 and File2)
File1 has some ids such as
009463_3922_1827
897654_8764_5432
File2 has things along the lines of:
Query= 009463_3922_1827 length=252
(252 letters)
More stufff here
... (5 Replies)
Discussion started by: Deep9000
5 Replies
2. Shell Programming and Scripting
HiCan someone show me how to print all lines from a file after a line matching a pattern using sed?Thanks (13 Replies)
Discussion started by: steadyonabix
13 Replies
3. Shell Programming and Scripting
Hi All,
Please find the sample file below:
NAME ID NUMBER
-------------------------------------------------------------------------------------------------- ---------
abcdefgheija;lksdf ... (13 Replies)
Discussion started by: niel.verty
13 Replies
4. Shell Programming and Scripting
I have in a file
domain.com. 1909 IN A 1.22.33.44
domain.com. 1909 IN A 22.33.44.55
ns1.domain.com. 1699 IN A 33.44.55.66
ns2.domain.com. 1806 IN A 77.77.66.66
I need to "grep" or "awk" out the lines starting with domain.com. as follows.
domain.com. 1909 IN A 1.22.33.44
domain.com.... (3 Replies)
Discussion started by: anilcliff
3 Replies
5. Shell Programming and Scripting
i have a file as below
sample.pl
parameter1
argument1
argument2
parameter2
I want out as below
argument1
argument2
that is , i want to print all the lines between parameter1 & parameter 2.
i tried with the following
if($mystring =~ m/parameter1(.*?)parameter2/) (2 Replies)
Discussion started by: roopa
2 Replies
6. Shell Programming and Scripting
I am using Solaris, I want to print
3 lines before pattern match
pattern
5 lines after pattern match
Pattern is abcd to be searched in a.txt. Looking for the solution in sed/awk/perl. Thanks ..
Input File a.txt:
=================
1
2
3
abcd
4
5
6
7
8 (7 Replies)
Discussion started by: manuswami
7 Replies
7. Shell Programming and Scripting
i need to search for a pattern from a big file and print everything expect the next 6 lines from where the pattern match was made. (8 Replies)
Discussion started by: chidori
8 Replies
8. Shell Programming and Scripting
I need to print the lines that do not match a pattern. I tried using grep -v and sed -n '/pattern/!p', but both of them are not working as I am passing the pattern as variable and it can be null some times.
Example
........ abcd......
.........abcd......
.........abcd......... (4 Replies)
Discussion started by: sunny1234
4 Replies
9. Shell Programming and Scripting
Data:
Pattern Data Data Data
Data Data Data
Data Data Data
...
With awk, how do I print the pattern matching line, then the subsequent lines following the pattern matching line. Varying number of lines following the pattern matching line. (9 Replies)
Discussion started by: dmesserly
9 Replies
10. Shell Programming and Scripting
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies
LEARN ABOUT DEBIAN
vbbatch
vbbatch(1) The VoxBo Manual vbbatch(1)
NAME
vbbatch - run a command line multiple times with variable substitution
SYNOPSIS
vbbatch <flag> ...
DESCRIPTION
vbbatch is part of the VoxBo suite of tools for brain image analysis.
vbbatch allows you to run a command multiple times with some variable substitutions (typically replacing the token FILE with each of a set
of filenames). The commands are then run in parallel. If a VoxBo cluster is detected, the jobs will be submitted to the cluster.
OPTIONS
EXAMPLES
To run myscript.sh on all your subjects' Anatomy directories:
vbbatch -c "myscript.sh FILE" study*/sub*/Anatomy -r
To run myperms.sh 1000 times at low priority, with different output files:
vbbatch -c "myperms.sh results_IND.nii.gz" -d 1000 -r -p xnice
AVAILABILITY
Pre-built VoxBo binaries are available for Linux, OSX, and Cygwin, and via the NeuroDebian project (neuro.debian.net) for Debian deriva-
tives.
CAVEATS
VoxBo is provided with no warranty whatsoever.
AUTHOR
For an historical roster of the VoxBo development team, visit www.voxbo.org.
SEE ALSO
For detailed help on any VoxBo command-line program, run it with no arguments. For graphical programs, use the -h flag. For more help
with VoxBo, for information about the mailing list, or to report bugs, visit the web site at www.voxbo.org.
For information about file format support in VoxBo, see voxbo-fileformats(7). For general information about VoxBo, see voxbo(7).
VoxBo January, 2011 (v1.8.5) vbbatch(1)