hi,
I want to print all the lines between the matching braces.
For example,the file contains like the below.
asdfsdf
fsdfsd
WO{
w1{
ada
... (3 Replies)
Hi there
does anybody know how i can get the line number from an entry or entries in a file ?? for example if i had a file
test1
test2
test3
test1
and i needed to get the line numbers for all instances of test1 in that file
with the answer being (1,4)
Would anybody be able... (7 Replies)
I am reading a cpp file thru shell script . There are many fuctions inside the cpp file
eg
pvvd_fncn_name1
{
..... something
}
pvvd_fncn_name2
{
..... something
}
what I require is a method to find the first opening brace and the coresponding last brace and search... (2 Replies)
Hi,
I have several block of text that I need to select, however this text may be spread over several lines and contains the '{' and '}' within it.
For e.g.,
ABC=100{
DEF = 200
{
GHI,
JKL
}
}
#2nd Block
123
{
456{78,910}}
}I am trying to figure out how to remove... (2 Replies)
Hi All,
My file looks some thing like this,
File 1: -
A 10
B 30
C 5
D 25
E 72
F 23
now my requirement is to find the line with highest number in it, i;e the result should be
E 72
Thanks in Advance (1 Reply)
Hi all,
I want to display line number for matching string in a file. can anyone please help me.
I used
grep -n "ABC" file
so it displays
6 ABC.
But i only want to have line number,i don't want that it should prefix matching context with line number.
Actually my original... (10 Replies)
Hello All,
What i am doing is , i tail a file from certain chatacter and then cat -n to get the line numbers.I search for a particular string and gets it line number. What i am interested in is the next line immediately after the pattern i search.
But grep gives me result for all line... (5 Replies)
Hi Frnds,
I need to find the line number of a particular line in a file and store that line number to a variable.
if a file named myfile contains following
look at the sun
look at the moon
look at the star
look at the ocean
i need to get the line number of the line 'look at the... (3 Replies)
Hello,
I am trying to find out the line numbers where regex match and put them into a file with below command:
awk '/'$pat'/ {print NR}' $fileName >> temp.txt
where $pat is the regex
but this command is taking a lot of time to execute with bigger files for size more than 5000000... (8 Replies)
Discussion started by: JoeColeEPL9
8 Replies
LEARN ABOUT DEBIAN
cps::governor
CPS::Governor(3pm) User Contributed Perl Documentation CPS::Governor(3pm)NAME
"CPS::Governor" - control the iteration of the "CPS" functions
DESCRIPTION
Objects based on this abstract class are used by the "gk*" variants of the CPS functions, to control their behavior. These objects are
expected to provide a method, "again", which the functions will use to re-invoke iterations of loops, and so on. By providing a different
implementation of this method, governor objects can provide such behaviours as rate-limiting, asynchronisation or parallelism, and
integration with event-based IO frameworks.
CONSTRUCTOR
$gov = CPS::Governor->new
Must be called on a subclass which implements the "again" method. Returns a new instance of a governor object in that class.
SUBCLASS METHODS
Because this is an abstract class, instances of it can only be constructed on a subclass which implements the following methods:
$gov->again( $code, @args )
Execute the function given in the "CODE" reference $code, passing in the arguments @args. If this is going to be executed immediately, it
should be invoked using a tail-call directly by the "again" method, so that the stack does not grow arbitrarily. This can be achieved by,
for example:
@_ = @args;
goto &$code;
Alternatively, the Sub::Call::Tail may be used to apply syntactic sugar, allowing you to write instead:
use Sub::Call::Tail;
...
tail $code->( @args );
EXAMPLES
A Governor With A Time Delay
Consider the following subclass, which implements a "CPS::Governor" subclass that calls "sleep()" between every invocation.
package Governor::Sleep
use base qw( CPS::Governor );
sub new
{
my $class = shift;
my ( $delay ) = @_;
my $self = $class->SUPER::new;
$self->{delay} = $delay;
return $self;
}
sub again
{
my $self = shift;
my $code = shift;
sleep $self->{delay};
# @args are still in @_
goto &$code;
}
SEE ALSO
o Sub::Call::Tail - Tail calls for subroutines and methods
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2012-06-27 CPS::Governor(3pm)