[10139] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3732 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 16 18:07:45 1998

Date: Wed, 16 Sep 98 15:01:25 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 16 Sep 1998     Volume: 8 Number: 3732

Today's topics:
        Printing lines between patterns <nkanth@cnd.hp.com>
    Re: Printing lines between patterns <ajohnson@gpu.srv.ualberta.ca>
        problem solved!! Re: Writing to a file and then reading <lydia@protospace.com>
        splitting by certain spaces (Steve .)
    Re: splitting by certain spaces (Honza Pazdziora)
    Re: splitting by certain spaces <nkanth@cnd.hp.com>
    Re: Who posts original posts on CLPM? <sauvin@osmic.com>
    Re: Who posts original posts on CLPM? <eashton@bbnplanet.com>
    Re: Who posts original posts on CLPM? <sauvin@osmic.com>
    Re: Y2K date in Perl (Patrick Timmins)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 16 Sep 1998 14:59:37 -0600
From: Srikanth Natarajan <nkanth@cnd.hp.com>
Subject: Printing lines between patterns
Message-Id: <360026B9.A6B80DB3@cnd.hp.com>

I have a file which has data like
BEGIN
 ...
 ...
 ..
END

I want to print all the lines between BEGIN and END

Any way to do this?

Srikanth


------------------------------

Date: Wed, 16 Sep 1998 16:26:16 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Printing lines between patterns
Message-Id: <36002CF8.57ECD208@gpu.srv.ualberta.ca>

Srikanth Natarajan wrote:
> 
> I have a file which has data like
> BEGIN
> ...
> ...
> ..
> END
> 
> I want to print all the lines between BEGIN and END
> 
> Any way to do this?

short answer: yes.

long answer:
	read in file by lines.
	when you find BEGIN, start printing.
	when you find END, stop printing.

you may want to look at perlfaq6:
perlfaq6.pod:=head2 How can I pull out lines between two patterns that
are themselves on different lines?

hope that helps
regards
andrew


------------------------------

Date: Wed, 16 Sep 1998 15:29:33 -0500
From: Lydia Scharon <lydia@protospace.com>
Subject: problem solved!! Re: Writing to a file and then reading it in again
Message-Id: <36001FAD.8721E401@protospace.com>

nevermind

I goofed and found the error in my script...

thanks though

lydia

Lydia Scharon wrote:

> I have what I thought would be a simple task, but now I just have
> questions.





------------------------------

Date: Wed, 16 Sep 1998 20:59:07 GMT
From: syarbrou@ais.net (Steve .)
Subject: splitting by certain spaces
Message-Id: <36002547.2164860@news.ais.net>

I have a file that has input in the following format:

filename    23434        02-06-98   this is a file that does bla bla.

There are various spaces above, the least amount being two between the
selected fields so I do a :

@data = split(/  +/,$line);

The above split has two spaces and a +

Works fine.  The problem is occasionally the description field has two
spaces in it between words rather than one and the array gets an extra
field of data which screws everything up.  

Basically I need to split the first three fields, as I do with the
split above, and then say the rest of this line put in here.  How
would I do this?  Thanks.  

Steve


------------------------------

Date: Wed, 16 Sep 1998 21:02:21 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: splitting by certain spaces
Message-Id: <slrn7009qs.j3.adelton@aisa.fi.muni.cz>

On Wed, 16 Sep 1998 20:59:07 GMT, Steve . <syarbrou@ais.net> wrote:

> Basically I need to split the first three fields, as I do with the
> split above, and then say the rest of this line put in here.  How
> would I do this?  Thanks.  

You will want to explore the third argument to split, it doesn't
exactly what you want.

Cheers,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


------------------------------

Date: Wed, 16 Sep 1998 15:13:32 -0600
From: Srikanth Natarajan <nkanth@cnd.hp.com>
Subject: Re: splitting by certain spaces
Message-Id: <360029FC.88182FE8@cnd.hp.com>

If you do not care about one or two spaces in the fourth field
you may do a split of your line using a / +/
(Note: onl one space in / +/ )
then shift @data till you get the fourth field

Once you hit the fourth field do a join(" ", @data) 
this will give you the fourth field with only one space separating
the words.

Steve . wrote:

Srikanth
> 
> I have a file that has input in the following format:
> 
> filename    23434        02-06-98   this is a file that does bla bla.
> 
> There are various spaces above, the least amount being two between the
> selected fields so I do a :
> 
> @data = split(/  +/,$line);
> 
> The above split has two spaces and a +
> 
> Works fine.  The problem is occasionally the description field has two
> spaces in it between words rather than one and the array gets an extra
> field of data which screws everything up.
> 
> Basically I need to split the first three fields, as I do with the
> split above, and then say the rest of this line put in here.  How
> would I do this?  Thanks.
> 
> Steve


------------------------------

Date: Wed, 16 Sep 1998 17:08:24 -0400
From: Ben Sauvin <sauvin@osmic.com>
Subject: Re: Who posts original posts on CLPM?
Message-Id: <360028C8.89DDB55B@osmic.com>



Elaine -HappyFunBall- Ashton wrote:

> Paul J. Adams wrote:
>
> > I'm not entirely sure of what you're objecting to.  Let me try to simplify
> > the issue.  For the moment, let's assume that we've determined that Windows
> > users are more likely to post root messages than *nix users.  (Asher's
> > statistics indicate that when comparing Windows to *nix users, disregarding
> > other operating systems, 68% of the root messages come from Windows users,
> > and 32% come from *nix users).
>
> STATISTICS?!?! You may be reading but you aren't comprehending.

    Expand and support this statement.

>
>
> > You seem to want to "deconstruct" this statistic and undermine it's
> > validity.  Okay, that's fine.  Perhaps you believe that there may be
> > underlying factors which might account for this discrepancy.  Here's the
> > one clear objection you have raised:
>
> Deconstruct that which has no foundation? Raw data that draws
> dangerously inaccurate conclusions. Nothing more.
>

    Foundation is refuted without countersubstantiating evidence..

>
> > You should be able to see that this does not diminish the relevance of
> > Asher's statistic unless you've changed your posting behavior in the
> > process of changing software.
>
> Again, you glorify raw data as 'statistics'. If he was, indeed, trying
> to show that, where is the correlation?

>
> > Again, lets keep it simple and consider only the Windows vs. *nix
> > discrepancy regardless of the news reader used on a particular platform.
> > If a significant number of users jump back and forth from one platform to
> > another, without significantly modifying their posting behavior, then this
> > will be a normalizing influence on the statistics.  The more people switch
> > platforms, the more the users of the two platforms will come to resemble
> > one another.  If the platform used by each poster was randomized every time
> > they posted, then the statistics would gravitate to a 50%/50% split of root
> > messages distributed by platform.  Therefore, your objection seems to
> > indicate that Asher's statistic may be somewhat understated, rather than
> > overstated.  In other words, the fact that he has "assumed out" the random
> > migration from one platform to another can not result in an inflated
> > discrepancy.
>
> *sigh* I use whatever computer is available to me at any given time,
> regardless of OS. I also have a pseudonym that posts reqularly on a
> single platform. Now, if the 'statistics' were taking that into
> consideration I would imagine it would be somewhere in the standard
> error. Oh, wait, there wasn't one was there?
>
> I'm just having fun here so don't take this too seriously. But I do
> cringe when raw data is called 'statistics'.
>
> > The only exception I can imagine would be if there was a sudden massive
> > migration of a particular "type" of poster from one platform to another.
> > Do you have any evidence that such a migration has taken place?  If so, it
> > would be interesting to analyze the causes of such a migration.  Such a
> > phenomenon would certainly suggest, if not prove, that the different
> > platforms attract different types of users.
>
> Well, that would, indeed, be an interesting phenomenon to track, but
> this is far from being able to do that.
>
> > The fact that despite random migration there remains a greater than 2 to 1
> > discrepancy in the root message posting behavior between Windows and *nix
> > users seems to indicate that this is a statistic worthy of attention.  You
> > may object that the several hundred messages analyzed don't constitute a
> > large enough sample.  If so, then you should feel free to present contrary
> > evidence or at least suggest what size sample ought to be used.
>
> There you go again calling raw data 'statistics'.

    Small sampling theory can characterise populations with an accuracy of which
Ashton seems unaware. Several hundred posts taken at random from random
newsgroups might prove illustrative; larger samples may well involve greater
processing for diminishing theoretical return.

    In any event, a summary statement of raw data with no further processing
remains a statistic, however unprocessed. Quibbling with the meaning of this
statement is playing at semantics.

>
>
> I am neither a statistician or a demographer, so I will refrain from
> suggesting how one might go about the study of this. It is entirely
> possible someone has already done this with the help of both.

    So it would appear.

>
>
> > Well, these objections don't seem to merit quite so deep an analysis, so
> > I'll simply let them stand for now.
>
> Nope. That was the Scotsman who took me prisoner and made me write that.
> He didn't make me write 'Krap' with a K though. :)
>
> e.
>
> "All of us, all of us, all of us trying to save our immortal souls, some
> ways seemingly more round-about and mysterious than others. We're having
> a good time here. But hope all will be revealed soon."  R. Carver



------------------------------

Date: Wed, 16 Sep 1998 21:10:18 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Who posts original posts on CLPM?
Message-Id: <360026D7.D1417673@bbnplanet.com>

Ben Sauvin wrote:

>     Small sampling theory can characterise populations with an accuracy of which
> Ashton seems unaware. Several hundred posts taken at random from random
> newsgroups might prove illustrative; larger samples may well involve greater
> processing for diminishing theoretical return.
> 
>     In any event, a summary statement of raw data with no further processing
> remains a statistic, however unprocessed. Quibbling with the meaning of this
> statement is playing at semantics.

Small sampling theory is one thing, 500 posts is quite another. I
disagree, why don't we just leave it at that. Raw data is not a
statistic, no semantics involved.

> > I am neither a statistician or a demographer, so I will refrain from
> > suggesting how one might go about the study of this. It is entirely
> > possible someone has already done this with the help of both.
> 
>     So it would appear.

And you are either/both? 

e.

"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon."  R. Carver


------------------------------

Date: Wed, 16 Sep 1998 17:15:19 -0400
From: Ben Sauvin <sauvin@osmic.com>
Subject: Re: Who posts original posts on CLPM?
Message-Id: <36002A67.609D9828@osmic.com>


    The "scientific method" that I recall involves the formation of some working
hypothesis which is consequently subject to carefully designed experiementation to
contrast predicted behaviour or conditions against observed results. In an iterative
process, the hypothesis is refined as new information emerges, or is discarded when
materially refuted.

    I see no such effort here.

Elaine -HappyFunBall- Ashton wrote:

> Ben Sauvin wrote:
>
> >     Define "scientific method" within the context of him or her who bemoans its
> > misapplication.
>
> I could be flip here, but seriously....The 'scientific method' is a
> loosely held protocol accepted by those who methodically seek to answer
> questions as accurately and honestly as possible. My objection to this
> person was not the data, but that he started with an assumption of a
> 'truth' and then sought out to prove that with raw and misleading data.
> There is no demographic information, no correlation and no standard
> error in his presentation of the 'facts'. Hence, there was no method,
> much less scientific.
>
> This is also somewhat applicable to Perl and how it is used. One starts
> with a problem and seeks to solve it. If you have a misconception it
> could waste you hours or more of programming time. All disciplines
> relate.
>
> e.
>
> "All of us, all of us, all of us trying to save our immortal souls, some
> ways seemingly more round-about and mysterious than others. We're having
> a good time here. But hope all will be revealed soon."  R. Carver



------------------------------

Date: Wed, 16 Sep 1998 20:08:19 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Y2K date in Perl
Message-Id: <6tp5rj$pte$1@nnrp1.dejanews.com>

In article <01bde191$14cf9d60$a86b412f@PBPDB857.ca.nortel.com>,
  "Milan Spingl" <mspring@nortel.com> wrote:
> Hi there.
> What is the best way to get the system date? my $sdate=`date`; does not
> always work and localtime(time) does not include century. Prefixing the
> year with '19' is not an option as a Y2K comlpliancy is an issue. BTW, we
> run Perl 5.002 on a HP-UX 9.05 on a HP9000/735 box.
> Thanks...Milan
>

Prefixing the year with '19' is not an option, as Y2K comlpliancy
is an issue. Search perlfaq4 - Data Manipulation. There is a good
example there for you.

or this should work as well:

@array_now = localtime;
$noncompliant_year = $array_now[5];
$compliant_year = ((5700+3*$noncompliant_year)/sqrt(9));

Patrick Timmins
U. Nebraska Medical Center

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


------------------------------

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3732
**************************************

home help back first fref pref prev next nref lref last post