"John W. Krahn" wrote:
>
> my $before = 1;
> my $after = 1;
> my @buffer;
>
> while ( my $line = ) {
>
> push @buffer, $line;
>
> shift @buffer if $#buffer > $before + $after;
>
> next if $#buffer < $before;
>
> if ( $buffer[ $before ] =~ /found matching regex/ ) {
>
>
Jerry Rocteur wrote:
>
> Hi,
Hello,
> Anyone know how to write a grep -C in Perl ?
Yes, someone definitely does:
http://www.perl.com/language/ppt/src/grep/index.html
> You know, I want to search for a string/regexp in a file and I want to
> print the line before and the line a
Hi, Jerry, :)
On Tue, 10 Dec 2002, Jerry Rocteur wrote:
> Anyone know how to write a grep -C in Perl ?
Here is a script that mimics just the '-C' feature of GNU grep. It
doesn't support the fanciness of printing filenames when multiple
input files are specified.
This may be
Message-
From: Jerry Rocteur [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 10, 2002 3:23 PM
To: [EMAIL PROTECTED]
Subject: GNU grep -C in Perl
Hi,
Anyone know how to write a grep -C in Perl ?
You know, I want to search for a string/regexp in a file and I want to
print the line before
c 10, 2002, at 21:22 Europe/Brussels, Jerry Rocteur wrote:
Hi,
Anyone know how to write a grep -C in Perl ?
You know, I want to search for a string/regexp in a file and I want to
print the line before and the line after the search string.
I've tried a couple of ways and it takes a reall
>Anyone know how to write a grep -C in Perl ?
Why not just store the previous line, then when you have a match,
print it, the matching line, then set a flag to print the next line as well?
Something along the lines of:
while ($line = ) {
if ($print_n
Hi,
Anyone know how to write a grep -C in Perl ?
You know, I want to search for a string/regexp in a file and I want to
print the line before and the line after the search string.
I've tried a couple of ways and it takes a really long time, I load the
file in memory, seach for the s
hi,
You may declare my variables at the outermost scope of a file to hide any such
identifiers from the world outside that file. This is similar to C's static variables
when they are used at the file level. To do this with a subroutine requires the use of
a closure (an anonymous function th
On Thu, Aug 01, 2002 at 10:13:42AM -0700, Andrew Killam wrote:
> Hi, guys. This is my first message to the list, so if I'm violating
> any posting procedures, please forgive me - I'll learn quickly enough.
The only thing I would complain about is that your lines are too long,
but I'd aim that m
Hi, guys. This is my first message to the list, so if I'm violating any posting
procedures, please forgive me - I'll learn quickly enough.
I'm working a program manipulating trees read in from a database. My employers want
Perl used, but I believe parts of it would be better served using C fu
At 09:45 AM 6/8/01 -0400, [EMAIL PROTECTED] wrote:
>Hey all,
>
>I'm rather new to perl, and was just woundering what was the best route to
>go to Exec c++ from within a perl script. Is there a PM for this?
I haven't used it personally, but there has been a fair amount of talk
about Inline.pm .
cc: (bcc: Peter Farrar/Waltham/MCS/Concentra)|
| Subject: C++ in perl.|
>|
Hey all,
I'm rather new to perl, and was just wounder
On 08 Jun 2001 09:45:09 -0400, [EMAIL PROTECTED] wrote:
> Hey all,
>
> I'm rather new to perl, and was just woundering what was the best route to
> go to Exec c++ from within a perl script. Is there a PM for this?
>
>
>
> thank in advance.
>
>
>
Having never done it myself, I can only poin
Hey all,
I'm rather new to perl, and was just woundering what was the best route to
go to Exec c++ from within a perl script. Is there a PM for this?
thank in advance.
14 matches
Mail list logo