[14064] in Perl-Users-Digest
Perl-Users Digest, Issue: 1474 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 24 00:08:46 1999
Date: Tue, 23 Nov 1999 21:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <943419911-v9-i1474@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 23 Nov 1999 Volume: 9 Number: 1474
Today's topics:
Archive::Tar Sending File to Browser? <wddjr@mediaone.net>
Re: Best book on Perl <uri@sysarch.com>
Re: can a "cookie-monster" mess with my cookies? <bwalton@rochester.rr.com>
filehandles and access symbols (Max)
Re: getlogin() (Martien Verbruggen)
HASH Implementation (Mark-Jason Dominus)
Help sort files in a directory <David@weddingguide.co.uk>
Re: Help sort files in a directory <uri@sysarch.com>
Re: Help sort files in a directory (Abigail)
Re: Initialize Variables lee.lindley@bigfoot.com
Re: need help with regular expr. (Ken Bandes)
Re: need help with regular expr. (Uldoz)
Re: newbie PERL question <jeff@vpservices.com>
Re: Outputting "#" in URL for anchoring <cau.quach@sympatico.ca>
Re: Percentages Question (Abigail)
Re: Perl ,Novell, windows, NT and Unix <wyzelli@yahoo.com>
Perl used for Oracle? <ibm_97@yahoo.com>
Re: Perl used for Oracle? (Richard Warkentin)
pike <sp00fD@yahoo.com>
Pipe To Script <grossole@slu.edu>
Re: Please! Help with hashes within hashes!!!! (Uldoz)
Re: Portuguese Whaling Songs <wyzelli@yahoo.com>
Re: Portuguese Whaling Songs (Abigail)
Re: Portuguese Whaling Songs (Abigail)
Re: Portuguese Whaling Songs (Abigail)
Re: return some perl result into the calling shell scri <mecks@ust.hk>
using regex to extract data <jason.dreyerNOjaSPAM@home.com.invalid>
Re: using regex to extract data <bwalton@rochester.rr.com>
Re: using regex to extract data <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 23 Nov 1999 23:06:24 -0500
From: WDDobbs <wddjr@mediaone.net>
Subject: Archive::Tar Sending File to Browser?
Message-Id: <383B6440.F88D7994@mediaone.net>
I wrote a CGI script that takes a series of files and tars them up into
an archive. The script gets its input from posted form data. If I
supply a filename in the write method of Archive::Tar, I get a valid
archive on disk but I want to send it to the client as type
application/x-tar. I can successfully write the file to disk and then
give the user a link to the file on the next html page but then I have
all these old archives hanging around on the web server taking up space
(lots of space 10-20MB files). I want to pass the file back to the
browser and then either delete the temp file if writing to disk, or
allow memory to be reclaimed by the system once the script completes
execution.
When I am in the browser (netscape), I get a save file dialog but he
file name is always the name of my perlscript (perlscript.pl) by
default. How do I get the desired filename to be the default in the
save dialog? If I rename the default to temp.tar, and then use winzip,
I am able to read the archive.
Anyone have any suggestions? I'm kind of "floundering" at this point.
Even some suggested reading and or keywords would be welcomed.
Thanks Very Much.
W.Dobbs
wddjr@mediaone.net
------------------------------
Date: 23 Nov 1999 22:18:06 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Best book on Perl
Message-Id: <x74secmvbl.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> 16:51:50 -0800, David Cassell <cassell@mail.cor.epa.gov> says...
>> I'm not being flippant. There are some good books to learn
>> Perl. I recommend different ones depending on the background
>> of the querent, but if you have no programming background
>> [HTML doesn't count] then you should probably get "Elements
>> of Programming with Perl" by Andrew Johnson.
LR> Are you getting a kickback for all these ads?
if he does, then i should! :-)
LR> Seriously, on your recommendation I bought a copy of the book, and
LR> though I haven't read everything yet, I haven't found anything to
LR> criticize yet either.
it is hard to judge a book aimed at non-programmers when we are all (i
hope) experienced hackers. but johnson's book unlike some infamous ones,
does not talk down to the reader and is fun to read. i am slowly getting
through it (tough learning all that difficult perl syntax) and i like it
a lot. it is in my new spare bathroom and johnson told to to take longer
visits. :-)
LR> Any book (for beginners, yet!) that includes Abigail's prime-number
LR> generator can't be anything but exceptional.
i heard about it and checked it out. definitely the most complex example
(not in code space but execution space) i have ever seen in a beginner's
book.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 23 Nov 1999 23:06:09 -0500
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: can a "cookie-monster" mess with my cookies?
Message-Id: <383B6431.AE6835A6@rochester.rr.com>
BLIMP8 wrote:
<off-topic post deleted>
> sam
> blimp8@aol.com
This is off-topic for this newsgroup. Try
comp.infosystems.www.authoring.cgi or one
like it.
--
Bob Walton
------------------------------
Date: Wed, 24 Nov 1999 04:31:13 GMT
From: junkmail@kenobiz.com (Max)
Subject: filehandles and access symbols
Message-Id: <383b6884.33435438@news.acronet.net>
is there anyway that i can open a file just once to read it and then
overwrite its contents?
open(BLAH,"+>blah.txt") erases the file contents before i even get
to read it and.....
open(BLAH,"+<blah.txt") allows me to read but only APPEND the data
that i write to it
im just trying to avoid having to open it to read it, then close it
and open it again to overwrite it, because by closing the file i lose
the flock and that gives other instances of the program a chance to
overwrite the contents of the file
what i am writing to the file is simply a number that will be
incremented by 1 every time the script is run
any solutions are gladly welcome
thank you very much
------------------------------
Date: Wed, 24 Nov 1999 02:16:16 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: getlogin()
Message-Id: <QTH_3.459$6Y1.4265@nsw.nnrp.telstra.net>
On Tue, 23 Nov 1999 18:23:31 GMT,
Brett W. McCoy <bmccoy@foiservices.com> wrote:
> Also Sprach Paul Walkerp <paul.walker@st.com>:
>
> >Quick question - getlogin() is limited to returning 8 characters for a
> >username. Is that because the OS only returns 8 characters, or just a
> >limitation for some other reason?
>
> Where does it say that it is limited 8 characters, and on what OS?
It's probably not getlogin that's limited, and the OP might be a bit
confused, but there are OS's where the login name is limited to 8
characters:
# man 5 passwd
[snip]
username is the user's login name. This field con-
tains no uppercase characters, and must not
be more than eight characters in length.
[snip]
# uname -a
SunOS titan 4.1.3_U1 3 sun4m
#
Sure. Totally stupid, but it's there :)
Martien
--
Martien Verbruggen |
Interactive Media Division | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: Wed, 24 Nov 1999 04:59:17 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: HASH Implementation
Message-Id: <81fra8$lii$1@monet.op.net>
In article <z6Q6ONbjjT2cnA1tM95X6Df7wQ6e@4ax.com>,
Bill Cox <bilcox@wnt.sas.com> wrote:
>Does Perl basically assign an exclusive name space for each hash then
>just assign variables in that namespace to create elements of the
>array? (To then get all the elements - just return all the variables
>created in that namespace.)
No, just the opposite. In Perl, a name space is implemented as a
hash. For example, when you acccess a variable $foo, Perl looks up
the key `foo' in a special hash and gets the value from the hash.
------------------------------
Date: Wed, 24 Nov 1999 02:31:33 -0000
From: "Wedding Guide.co.uk" <David@weddingguide.co.uk>
Subject: Help sort files in a directory
Message-Id: <81fij5$1t1$1@uranium.btinternet.com>
Is there a way of sorting files in a directory by last access using perl.
Tia
David
------------------------------
Date: 23 Nov 1999 22:22:15 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Help sort files in a directory
Message-Id: <x71z9gmv4o.fsf@home.sysarch.com>
>>>>> "WGcu" == Wedding Guide co uk <David@weddingguide.co.uk> writes:
WGcu> Is there a way of sorting files in a directory by last access
WGcu> using perl. Tia
match them in pairs and send them down the aisle!
couldn't resist :-)
read perlfaq4: How do I sort an array by (anything)?
then learn how to get the access times of files: perldoc -f -X
put them together and your problem is solved.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 23 Nov 1999 22:46:00 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Help sort files in a directory
Message-Id: <slrn83mrid.m2v.abigail@alexandra.delanet.com>
Wedding Guide.co.uk (David@weddingguide.co.uk) wrote on MMCCLXXVI
September MCMXCIII in <URL:news:81fij5$1t1$1@uranium.btinternet.com>:
~~ Is there a way of sorting files in a directory by last access using perl.
Yes.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 24 Nov 1999 01:59:20 GMT
From: lee.lindley@bigfoot.com
Subject: Re: Initialize Variables
Message-Id: <81fgpo$lr7$1@rguxd.viasystems.com>
Abigail <abigail@delanet.com> wrote:
:> reset 'aB'; # ;-)
Cool. Never noticed the 'reset' function before. It's listed
in perlfunc but it never jumped into my awareness until now.
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: Wed, 24 Nov 1999 03:36:08 GMT
From: kbandes@home.com (Ken Bandes)
Subject: Re: need help with regular expr.
Message-Id: <8E87E2A31kbandeshomecom@192.168.123.1>
venkatmohan@my-deja.com wrote in <81feig$rdv$1@nnrp1.deja.com>:
>I need to parse out the following string
>
>2323I am a 3343perl43progra!mer
>
>In this string I want to extract only the white space and alphabets
>(both lower and upper case).
>$a="2323I am a 3343perl43progra!mer";
>$a=~ s/(?![a-zA-Z\s]+)//g;
That's a negative lookahead - it avoids exactly what you want to
match, and also is zero-width so it doesn't capture anything.
You could do
$a = join '',$a =~ /\s|[a-zA-Z]/g;
Ken Bandes
------------------------------
Date: 24 Nov 1999 04:24:55 GMT
From: uldoz@cs.com (Uldoz)
Subject: Re: need help with regular expr.
Message-Id: <19991123232455.03896.00001611@ng-fy1.news.cs.com>
Try this
$text = "2323I am a 3343perl43progra!mer";
$text =~ tr/A-Za-z //cd;
print "$text\n";
The translate function take everything that is not (the c option) a upper or
lower case letter and a space and translated it to nothing (the d option). See
page 75 of the Blue Camel for some background.
Nelson
admiraln@yahoo.com
------------------------------
Date: 24 Nov 1999 01:34:26 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: newbie PERL question
Message-Id: <383B404F.38B44AAB@vpservices.com>
David Cassell wrote:
>
> Jeff Zucker wrote:
> >
> > Jonathan Yee wrote:
> >
> > > Newsgroups: alt.comp.perlcgi.freelance, alt.perl, comp.lang.perl.misc
> >
> > It's kind of overkill to post the same question to three newsgroups,
> > even if some of them don't exist.
>
> Jeff, I don't know how to break it to you, but *all*three*
> of those groups exist.
Ooops, silly me. <gilda> never mind </gilda>.
--
Jeff
------------------------------
Date: Wed, 24 Nov 1999 04:54:01 GMT
From: "Hacka" <cau.quach@sympatico.ca>
Subject: Re: Outputting "#" in URL for anchoring
Message-Id: <JbK_3.64667$up3.100887@news21.bellglobal.com>
<ether_nut@my-deja.com> wrote in message news:81ejse$77g$1@nnrp1.deja.com...
........."........./index.html#AZ\">\n";...............................
try ...."........./index.html?#AZ".........................
Kieu
------------------------------
Date: 23 Nov 1999 22:53:48 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Percentages Question
Message-Id: <slrn83ms10.m2v.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCCLXXVI September MCMXCIII in
<URL:news:MPG.12a4e16364478f9098a266@nntp.hpl.hp.com>:
//
// I think you have been reading too much Abigail! There was a thread last
// week on the 'reduce' concept, and Abigail submitted something like that
// for the 'sum' reducton. But it would have been expressed more like
// this:
//
// $avg = do { local $" = '+'; eval("@x")/@x };
Except for the spacing. There ought to be spaces around binary operators
and there's a space *before* an opening paren, but *not after*, nor before
a closing paren. Furthermore, avoid mixed quotes if possible. Hence:
$avg = do {local $" = "+"; eval ("@x") / @x};
// I am sure you realize that this is both slow and EEE-vil.
Yeah, but being evil puts me opposite to Barney, so that isn't too bad.
Abigail
--
perl -e 'for (s??4a75737420616e6f74686572205065726c204861636b65720as?;??;??)
{s?(..)s\??qq \?print chr 0x$1 and q ss\??excess}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 24 Nov 1999 11:51:11 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Perl ,Novell, windows, NT and Unix
Message-Id: <rYH_3.17$l_4.2321@vic.nntp.telstra.net>
John Armsby <jaws@mindspring.com> wrote in message
news:383b3e01.858676@news.mindspring.com...
>
> In the PC environment, long filenames and spaces in the filename are a
> matter of course. My script below works ON THE WINDOWS98/NT MACHINE I
> have at work as long as there are no spaces in the file name. When I
> change the script to write to a Novell drive, longfilenames results in
> a CGI error. Spaces in the file name results in the resulting file
> having the last "word" in the file name string as the file name. Has
> anyone seen anomolies as these with Novell?
This may be a silly question but are long file names enabled on the Novell
server?
By default they aren't, you have to load the OS2 namespace.
Wyzelli
------------------------------
Date: 23 Nov 1999 19:26:25 PST
From: NJN <ibm_97@yahoo.com>
Subject: Perl used for Oracle?
Message-Id: <383B5AA9.C1F5023A@yahoo.com>
I will write some perl script to do Oracle admin job. I'm new to Perl.
My questions:
1. In perl, how can I call OS(in Unix) command, such as 'sqlplus'?
2. Also, how can I 'select * from v$database' after I enter 'sqlplus' in
perl?
3. which book is best for Perl?
Thanks a lot!!!!! Pls also email me a copy.
------------------------------
Date: Wed, 24 Nov 1999 03:53:21 GMT
From: "rdw2 at mindspring dot com"@test.com (Richard Warkentin)
Subject: Re: Perl used for Oracle?
Message-Id: <383b5ef5.871895229@news.mindspring.com>
Using the "DBI" interface to the Oracle DBD drivers is a more elegant
solution to your problem. The DBI & DBD modules are not part of the
perl distribution so you'll need to download them from CPAN. I
normally do my development on an NT system at home and move them to a
unix system without trouble.
The DBI modules are pretty easy to use, just follow the examples.
If you don't already lurk in comp.lang.perl.misc, you probably want to
give it a try.
On 23 Nov 1999 19:26:25 PST, NJN <ibm_97@yahoo.com> wrote:
>I will write some perl script to do Oracle admin job. I'm new to Perl.
>My questions:
>
>1. In perl, how can I call OS(in Unix) command, such as 'sqlplus'?
>2. Also, how can I 'select * from v$database' after I enter 'sqlplus' in
>perl?
>3. which book is best for Perl?
>
>Thanks a lot!!!!! Pls also email me a copy.
>
------------------------------
Date: Wed, 24 Nov 1999 01:55:27 GMT
From: sp00fD <sp00fD@yahoo.com>
Subject: pike
Message-Id: <81fgid$t0b$1@nnrp1.deja.com>
I've seen a lot of language comparisons between Perl => Python, Perl =>
java, etc.. I was wondering if anyone had any input into Perl => Pike
(http://pike.idonex.se/)? At first glance, it looks like a decent
language, although a bit too much like C/C++.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 Nov 1999 20:36:33 -0600
From: "Lenny grosso" <grossole@slu.edu>
Subject: Pipe To Script
Message-Id: <81fj50$3ei$1@systems2.slu.edu>
Hello,
I am trying to pipe emails from sendmail into my perl script. I am
doing this for a support script. So, once the email is piped into the
script it will be parsed and inserted into a mysql database. This would
work, except for that sendmail won't pipe into the script. I get the same
error every time....
________________________________________________
----- The following addresses had permanent fatal errors -----
"|/home/httpd/html/support/mail.cgi"
(expanded from: <support@linux.slu.edu>)
----- Transcript of session follows -----
sh: mail.cgi not available for sendmail programs
554 "|/home/httpd/html/support/mail.cgi"... Service unavailable
________________________________________________
Does anybody know why this is happening and how i can get sendmail to pipe
to my perl script?
thanks much
Lenny Grosso
------------------------------
Date: 24 Nov 1999 04:49:03 GMT
From: uldoz@cs.com (Uldoz)
Subject: Re: Please! Help with hashes within hashes!!!!
Message-Id: <19991123234903.03896.00001613@ng-fy1.news.cs.com>
> It seems to work fine before I try to insert the
>internal hash into the external hash. But I can't seem to dereference the
>internal hash's items as I should.
I have a hunch that you may not have a handle on Hashes of Hashes. What do you
mean by "insert the internal hash into the external hash".
In the mean time I suggest you read in the Blue Camel pages 257 to 275. Page
270 is where HoH are discussed. See in the perl docs perlLoL section for
another source of the same info.
Nelson
admiraln@yahoo.com
------------------------------
Date: Wed, 24 Nov 1999 11:55:58 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Portuguese Whaling Songs
Message-Id: <X0I_3.18$l_4.2348@vic.nntp.telstra.net>
Craig Berry <cberry@cinenet.net> wrote in message
news:s3mf6ffarrp40@corp.supernews.com...
> John (jadapturNOSPAM@hotmail.com) wrote:
> : Portuguese Whaling Songs
> :
> : Anyone know where I can find info on Portuguese Whaling Songs of the
19th
> : Century?
>
> On CPAN (Cetacean Portuguese Antique Noodlings), of course!
>
I'm sure I've seen a reference to Portugese wailing, but I can't remeber
where..
Or maybe that was Perl 'whiling'...
Which is of course completely unrelated to Perl mining as referenced in an
earlier thread, though I always thought that should have been Perl Diving.
Maybe that is where the whales (wails) come into it...
I will stop before I get too silly (too late you say...)
Wyzelli
------------------------------
Date: 23 Nov 1999 22:55:52 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Portuguese Whaling Songs
Message-Id: <slrn83ms4t.m2v.abigail@alexandra.delanet.com>
Jeff Zucker (jeff@vpservices.com) wrote on MMCCLXXV September MCMXCIII in
<URL:news:383B22CD.6E8E48F0@vpservices.com>:
,,
,, Ah, but I can find the Perl content in the message:
,,
,, $msg = 'Portugese Whaling Songs';
,, $msg =~ s/^(.).(.)...(.)......(.).*$/$1$3$2$4/;
,,
,, Making a better re to do that is left as an exercise for the reader.
$msge =~ s/.*/Perl/;
HTH. HAND.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 23 Nov 1999 22:56:47 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Portuguese Whaling Songs
Message-Id: <slrn83ms6j.m2v.abigail@alexandra.delanet.com>
Uri Guttman (uri@sysarch.com) wrote on MMCCLXXVI September MCMXCIII in
<URL:news:x7aeo4n38k.fsf@home.sysarch.com>:
~~ >>>>> "JZ" == Jeff Zucker <jeff@vpservices.com> writes:
~~
~~ JZ> $msg = 'Portugese Whaling Songs';
~~ JZ> $msg =~ s/^(.).(.)...(.)......(.).*$/$1$3$2$4/;
~~
~~ JZ> Making a better re to do that is left as an exercise for the reader.
~~
~~ $msg = join '', substr( $msg, $_, 1) for 0,6,2,13 ;
Ok, ok, confess, where did you hide the re?
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 23 Nov 1999 22:58:21 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Portuguese Whaling Songs
Message-Id: <slrn83ms9g.m2v.abigail@alexandra.delanet.com>
Craig Berry (cberry@cinenet.net) wrote on MMCCLXXVI September MCMXCIII in
<URL:news:s3mf6ffarrp40@corp.supernews.com>:
|| John (jadapturNOSPAM@hotmail.com) wrote:
|| : Portuguese Whaling Songs
|| :
|| : Anyone know where I can find info on Portuguese Whaling Songs of the 19th
|| : Century?
||
|| On CPAN (Cetacean Portuguese Antique Noodlings), of course!
Isn't Portugal a bit too far south to have singing whales?
Abigail
--
perl -wlpe '}{$_=$.}{' file # Count the number of lines.
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 24 Nov 1999 10:32:12 +0800
From: mecks <mecks@ust.hk>
Subject: Re: return some perl result into the calling shell script
Message-Id: <383B4E2C.AFCE4530@ust.hk>
lee.lindley@bigfoot.com wrote
> Whenever you find yourself doing multiple print statements,
> you should learn to automatically reach for either a "here"
> document or an array of terms to print.
>
> print OUT
> "setenv YEARNEW", $YEARNEW, "\n",
> "setenv MONTHNEW", $MONTHNEW, "\n",
> ...;
>
> # Or, what seems to be the preferred method in this newsgroup
> print OUT <<EOF_VARS; # Don't forget the semicolon
> setenv YEARNEW $YEARNEW
> setenv MONTHNEW $MONTHNEW
> ...
> EOF_VARS
>
> // Lee.Lindley /// I used to think that being right was everything.
> // @bigfoot.com /// Then I matured into the realization that getting
> //////////////////// along was more important. Except on usenet.
Hi Lindley,
Thanks for your suggestion
Jim
------------------------------
Date: Tue, 23 Nov 1999 15:37:56 -0800
From: Jason Dreyer <jason.dreyerNOjaSPAM@home.com.invalid>
Subject: using regex to extract data
Message-Id: <1415c574.0c1726b4@usw-ex0101-001.remarq.com>
There are many postings regarding how to extract matched lines from a
log file. But, I'm having trouble finding info on how to extract
matched lines AFTER a line containing a specified date.
Here is a sample of the lines I am working with from a log file that is
created during user logon.
---------------------------------------
Date and Time: Wed Jul 07 08:07:44 1999
Description : CuteFTP
Description : Label Pro 3.0
Description : WinZip (16-bit)
Date and Time: Thu Oct 14 08:12:00 1999
Description : CuteFTP
Description : GoZilla
Description : WinZip (32-bit)
Date and Time: Thu Oct 28 08:16:00 1999
Description : VirusScan 4.02
Description : GoZilla
Description : WinZip (32-bit)
---------------------------------------
I need to be able to extract part of the "Description" lines after "Oct
14 1999". I have been using the following code.
if ($line =~ /Description : (.*)/);
But I end up with all the "Description" lines, including the ones from
"Jul 07 1999".
Also, I have tried the following code. But it will not work if the
user did not logon on until "Oct 15 1999" or sometime after.
if ($line =~ /Oct 14[^1999]/);
Thanks for your help.
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Tue, 23 Nov 1999 22:54:07 -0500
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: using regex to extract data
Message-Id: <383B615F.D4B7427F@rochester.rr.com>
Jason Dreyer wrote:
>
> There are many postings regarding how to extract matched lines from a
> log file. But, I'm having trouble finding info on how to extract
> matched lines AFTER a line containing a specified date.
>
How about the easy way: use Date::Manip;
> Here is a sample of the lines I am working with from a log file that is
> created during user logon.
> ---------------------------------------
> Date and Time: Wed Jul 07 08:07:44 1999
>
> Description : CuteFTP
> Description : Label Pro 3.0
> Description : WinZip (16-bit)
>
> Date and Time: Thu Oct 14 08:12:00 1999
>
> Description : CuteFTP
> Description : GoZilla
> Description : WinZip (32-bit)
>
> Date and Time: Thu Oct 28 08:16:00 1999
>
> Description : VirusScan 4.02
> Description : GoZilla
> Description : WinZip (32-bit)
> ---------------------------------------
>
> I need to be able to extract part of the "Description" lines after "Oct
> 14 1999". I have been using the following code.
>
> if ($line =~ /Description : (.*)/);
>
> But I end up with all the "Description" lines, including the ones from
> "Jul 07 1999".
>
> Also, I have tried the following code. But it will not work if the
> user did not logon on until "Oct 15 1999" or sometime after.
>
> if ($line =~ /Oct 14[^1999]/);
>
...
Try:
use Date::Manip;
$TZ='EST';
while(<>){
if(/^Date and Time: (.*)/){
$dateOK=
ParseDate($1)
gt
ParseDate('Oct 14, 1999 11:59:59 am');
}
next unless $dateOK;
if(/^Description\s+:\s(.*)/){
#do stuff with $1
print "Matched $1\n";
}
}
--
Bob Walton
------------------------------
Date: Tue, 23 Nov 1999 22:56:02 -0500
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: using regex to extract data
Message-Id: <383B61D2.AF26EC43@rochester.rr.com>
Bob Walton wrote:
>
> Jason Dreyer wrote:
...
> use Date::Manip;
> $TZ='EST';
> while(<>){
> if(/^Date and Time: (.*)/){
> $dateOK=
> ParseDate($1)
> gt
> ParseDate('Oct 14, 1999 11:59:59 am');
Oops, sb p, sorry------------------------------------------^
> }
> next unless $dateOK;
> if(/^Description\s+:\s(.*)/){
> #do stuff with $1
> print "Matched $1\n";
> }
> }
>
> --
> Bob Walton
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 1474
**************************************