[25333] in Perl-Users-Digest
Perl-Users Digest, Issue: 7578 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 27 18:06:15 2004
Date: Mon, 27 Dec 2004 15:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 27 Dec 2004 Volume: 10 Number: 7578
Today's topics:
Help needed for perl rookie <grlcopm@pacbell.net>
Re: Help needed for perl rookie ioneabu@yahoo.com
Re: Help needed for perl rookie <grlcopm@pacbell.net>
Re: how to delete files that create date <=20041210 <vilain@spamcop.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 27 Dec 2004 21:44:25 GMT
From: GRLCOPM <grlcopm@pacbell.net>
Subject: Help needed for perl rookie
Message-Id: <BDF5C1E0.2F7A9%grlcopm@pacbell.net>
I am new to perl, but so far have had decent success in writing/modifying
code to do what I want to do. However I am stuck trying to modify the
following code. I am sure the solution is quite simple, but I can't
completely figure out what this piece of code does. I think it is just
matching up a data pattern but this is an area I am unfamiliar with.
All I want to do is change the format of the data file from example #1 to
example #2 and need this section of code to work with the new format. I
would be grateful for any help provided in understanding what this piece of
code does and suggestions on the modification needed.
If more information or a larger chunk of the code is needed please let me
know and I will provide.
EXAMPLE #1 - Current format of data file:
0000000050 20041227 0000000003 'my-page.shtml'
0000000054 20041227 0000000004 'another-page.shtml'
0000000020 20041227 0000000003 'yet-another-page.shtml'
EXAMPLE #2 - New format of data file:
0000000050|20041227|0000000003|my-page.shtml
0000000054|20041227|0000000004|another-page.shtml
0000000020|20041227|0000000003|yet-another-page.shtml
Current code that reads original data format:
&LockOpen (COUNT,"$AccessFile");
$location = tell COUNT;
while ($line = <COUNT>) {
if (($acc,$day,$dayacc,$uri) = ($line =~ /^(\d+) (\d+) (\d+) '(\S+)'$/)) {
if ($uri eq $doc_uri) {
last;
}
}
last if ($uri eq $doc_uri);
$location = tell COUNT;
$acc = 0;
$dayacc = 0;
}
Thanks!
PM
------------------------------
Date: 27 Dec 2004 14:17:37 -0800
From: ioneabu@yahoo.com
Subject: Re: Help needed for perl rookie
Message-Id: <1104185857.405933.320190@f14g2000cwb.googlegroups.com>
GRLCOPM wrote:
> I am new to perl, but so far have had decent success in
writing/modifying
> code to do what I want to do. However I am stuck trying to modify the
> following code. I am sure the solution is quite simple, but I can't
> completely figure out what this piece of code does. I think it is
just
> matching up a data pattern but this is an area I am unfamiliar with.
>
> All I want to do is change the format of the data file from example
#1 to
> example #2 and need this section of code to work with the new format.
I
> would be grateful for any help provided in understanding what this
piece of
> code does and suggestions on the modification needed.
>
> If more information or a larger chunk of the code is needed please
let me
> know and I will provide.
>
> EXAMPLE #1 - Current format of data file:
> 0000000050 20041227 0000000003 'my-page.shtml'
> 0000000054 20041227 0000000004 'another-page.shtml'
> 0000000020 20041227 0000000003 'yet-another-page.shtml'
>
> EXAMPLE #2 - New format of data file:
> 0000000050|20041227|0000000003|my-page.shtml
> 0000000054|20041227|0000000004|another-page.shtml
> 0000000020|20041227|0000000003|yet-another-page.shtml
>
looks like you are replacing the spaces after the numbers with a '|'
and removing the single quotes.
s/(\d+)\s/$1|/g;
s/'//g;
maybe
> Current code that reads original data format:
>
> &LockOpen (COUNT,"$AccessFile");
> $location = tell COUNT;
> while ($line = <COUNT>) {
> if (($acc,$day,$dayacc,$uri) = ($line =~ /^(\d+) (\d+) (\d+)
'(\S+)'$/)) {
> if ($uri eq $doc_uri) {
> last;
> }
> }
> last if ($uri eq $doc_uri);
> $location = tell COUNT;
> $acc = 0;
> $dayacc = 0;
> }
>
>
> Thanks!
>
> PM
------------------------------
Date: Mon, 27 Dec 2004 22:29:57 GMT
From: GRLCOPM <grlcopm@pacbell.net>
Subject: Re: Help needed for perl rookie
Message-Id: <BDF5CC8C.30353%grlcopm@pacbell.net>
> From: ioneabu@yahoo.com
> Organization: http://groups.google.com
> Newsgroups: comp.lang.perl.misc
> Date: 27 Dec 2004 14:17:37 -0800
> Subject: Re: Help needed for perl rookie
>
>
> looks like you are replacing the spaces after the numbers with a '|'
> and removing the single quotes.
>
> s/(\d+)\s/$1|/g;
> s/'//g;
>
Yes, that is how I have changed the format of the data file. Replaced the
spaces with | and removed the single quotes from the last item on the line.
Can someone please explain what the the following line of code does and what
the replacement would be?
if (($acc,$day,$dayacc,$uri) = ($line =~ /^(\d+) (\d+) (\d+) '(\S+)'$/)) {
Thanks
Patrick
------------------------------
Date: Mon, 27 Dec 2004 14:47:51 -0800
From: Michael Vilain <vilain@spamcop.net>
Subject: Re: how to delete files that create date <=20041210
Message-Id: <vilain-FC3815.14475127122004@news.giganews.com>
In article <271220041032450330%jgibson@mail.arc.nasa.gov>,
Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:
> In article <cqpbk9$f00$1@netnews.hinet.net>, sonet
> <sonet.all@msa.hinet.net> wrote:
>
> > I can scan the dir and get all file create date.
> > if create date<=20041210 to delete this file.
> >
> > EX:
> > #!/usr/bin/perl
> > $a='file';
> > ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
> > $atime,$mtime,$ctime,$blksize,$blocks)
> > = stat("$a");
> > print $ctime;
>
> Please note that if you are using unix the ctime entry is NOT the file
> creation time. It is the file _CHANGE_ time, the last time at which the
> file status changed. See 'man stat' for those operations that modify
> the file status.
And has has been pointed out in various UNIX groups, it also depends on
your OS. Unix does not store the file's creation time. See the man
page on stat for info on the three times it stores there. So if you're
attempting this on a Linux or UNIX box, you're SOL.
--
DeeDee, don't press that button! DeeDee! NO! Dee...
------------------------------
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 7578
***************************************