[27800] in Perl-Users-Digest
Perl-Users Digest, Issue: 9164 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 16 21:05:51 2006
Date: Sun, 16 Apr 2006 18:05:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 16 Apr 2006 Volume: 10 Number: 9164
Today's topics:
help: newbie extracting lines from large file. <Super-User@mordor.net>
Re: PhpWiki to Mediawiki converter in php or perl? <rurban@x-ray.at>
unable to store data in DBI object <penguin@ihug.co.nz>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 16 Apr 2006 20:57:24 -0400
From: Super-User <Super-User@mordor.net>
Subject: help: newbie extracting lines from large file.
Message-Id: <YdydnaYwGO5FeN_ZnZ2dnUVZ_v-dnZ2d@comcast.com>
i am trying to parse a something similar to this format.
the staring line can be starting at any hour(line1)and last line can be
any hour.
when the day changes to the next day. the hour changes to 00 (line 12)
how can i extract the first 11 lines
(17:00 -> 23:38)
then
(00:01 -> 23:38)
and so on and so on into individual files until end of the file
basically i want to create a file for each 24 hours. the only
thing consistent is the first 00 for each day.
from the first occurrence of this /\[\d\] \[00:/
till the line before its next occurrence and also extract
the top portion (no 00 to start with) into seperate files.
[1] [17:00:00.234234] blan blah blah
[2] [17:30:00.234234] blan blah blah
[1] [17:34:00.234234] blan blah blah
[1] [18:00:00.234234] blan blah blah
[2] [19:30:00.234234] blan blah blah
[1] [20:34:00.234234] blan blah blah
[1] [21:00:00.234234] blan blah blah
[2] [22:30:00.234234] blan blah blah
[1] [23:25:00.234234] blan blah blah
[1] [23:34:00.234234] blan blah blah
[1] [23:38:00.234234] blan blah blah
[1] [00:01:00.234234] blan blah blah
[1] [00:04:00.234234] blan blah blah
[1] [00:08:00.234234] blan blah blah
[1] [03:59:00.234234] blan blah blah
[1] [05:24:00.234234] blan blah blah
[1] [09:38:00.234234] blan blah blah
[1] [17:00:00.234234] blan blah blah
[2] [17:30:00.234234] blan blah blah
[1] [17:34:00.234234] blan blah blah
[1] [18:00:00.234234] blan blah blah
[2] [19:30:00.234234] blan blah blah
[1] [20:34:00.234234] blan blah blah
[1] [21:00:00.234234] blan blah blah
[2] [22:30:00.234234] blan blah blah
[1] [23:25:00.234234] blan blah blah
[1] [23:34:00.234234] blan blah blah
[1] [23:38:00.234234] blan blah blah
[1] [00:01:00.234234] blan blah blah
[1] [00:04:00.234234] blan blah blah
[1] [00:08:00.234234] blan blah blah
[1] [03:59:00.234234] blan blah blah
[1] [05:24:00.234234] blan blah blah
[1] [09:38:00.234234] blan blah blah
all help is appreciated and thanks for looking.
thanks.
------------------------------
Date: Sun, 16 Apr 2006 20:25:02 +0200
From: Reini Urban <rurban@x-ray.at>
Subject: Re: PhpWiki to Mediawiki converter in php or perl?
Message-Id: <44428bfa$0$2084$79720d31@newsreader.inode.at>
news reader schrieb:
> I'd like to copy over about 350 entries from Server1 to Server2(I could
> apply a filter rule or semiautomatically create a list with entries to copy
>
> As the amount of entries is low I don't really need an optimized solution.
> Entries in server 2 can be overwritten.
>
> I wanted to have your advice:
> 1.) Is there already something similiar, that exists?
> 2.) Is there a Wikiadmin focused news group (I don't like mailing lists
> and web based forums, as you have to create a noew account for most of
> them or to increase your spam rate even more) ?
>
> If not:
> I know very little about the wiki internals and was thinking about a
> 'brute force' method, not knowing if something better exists:
>
> The idea:
> 1.) get all the entries from the phpWiki via mysql ( from table "wiki" )
> 2.) fix naming style (my phpwiki entries contain spaces)
> 3.) replace the phpWiki syntax with Mediawiki syntax (I found url with
> some sed rules, which are probably incomplete, but could be a goiod
> starting point) and fix naming styles of interlnal links.
> 4.) access the Mediawiki via http, authenticate and post the new entries
>
>
> My idea was to 'post' new entries though it is probaly slower than
> directly populating the mysql data base as this allows to populate
> Mediawiki without having to know how the internal mysql book keeping
> works exactly.
>
> thanks in advance for any ideas and bye
dump the phpwiki pages as xhtml,
convert it via the perl module HTML::WikiConverter::PhpWiki
(I contributed the PhpWiki reader)
import this into mediawiki.
The real problem is, that mediawiki started with a non-wiki special
syntax, and then the flock new wiki's didn't care neither and invented
their own syntax also.
--
Reini Urban (phpwiki admin)
http://phpwiki.org/
------------------------------
Date: Mon, 17 Apr 2006 12:12:22 +1200
From: "Jon" <penguin@ihug.co.nz>
Subject: unable to store data in DBI object
Message-Id: <e1umgb$g2c$1@lust.ihug.co.nz>
Hiya,
I'm working on adding table prefixes for an application, so that it can be
used with the same database but different sets of data. I thought the best
idea would be to store the prefix as part of the DBI object (eg:
$dbh->{'_prefix'} = $prefix;), however this isn't working.
Here is some code demonstrating the problem.
penguin@restless:~/scripts$ cat sqltest.pl
#!/usr/bin/perl
use lib './lib';
use Data::Dumper;
use sql;
use strict;
use warnings;
my $sql = new sql(
'database' => 'test',
'username' => 'username',
'password' => 'password',
'dbprefix' => 'anything',
);
print Dumper($sql);
penguin@restless:~/scripts$ cat lib/sql.pm
package sql;
use DBI;
use strict;
use warnings;
@sql::ISA = qw/DBI::db/;
sub new($%) {
my $class = shift;
my %opts = @_;
# Make sure we have all required arguments
foreach (qw/username database dbprefix/) {
die("No $_ supplied") unless $opts{$_};
}
# Create a database handle
my $dbh = DBI->connect("DBI:mysql:$opts{database}", $opts{username},
$opts{password});
|| die("Connection to database failed: ".$DBI::errstr);
# Record our table prefix in our DBI object
$dbh->{'_prefix'} = $opts{'dbprefix'};
return bless $dbh, $class;
}
1;
penguin@restless:~/scripts$ ./sqltest.pl
$VAR1 = bless( {}, 'sql' );
penguin@restless:~/scripts$
Thanks,
--
Jon
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9164
***************************************