On Mon, 14 Oct 2002 18:44:20 +0200
Abigail <[EMAIL PROTECTED]> wrote:

> On Mon, Oct 14, 2002 at 12:25:03PM -0400, iudicium ferat wrote:
> > I am somewhat beating my head against a brick wall here - so I think "Hey!
> > This sounds like a Fun With Perl project :)"
> > 
> > Here is the challenge -
> > 
> > You are presented with a MySQL Schema dump that is less than 9 million rows;
> > you should read the data row by row, finding each CREATE TABLE statement,
> > and displaying the next ~50 lines INCLUDING this line - do this recursively
> > until end of file is reached.
> 
> 
>     grep -A 50 'CREATE TABLE' file.sql
> 

and (my) perl way:

   #!/usr/bin/perl -n
   $c = 50 if /CREATE TABLE/;
   print if $c and $c--;

P! Vladi.
--
Vladi Belperchinov-Shabanski <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> 
http://www.biscom.net/~cade  http://cade.webbg.com  

Attachment: msg02621/pgp00000.pgp
Description: PGP signature

Reply via email to